Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91113141
pages_number_field.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 8, 01:19
Size
647 B
Mime Type
text/x-python
Expires
Sun, Nov 10, 01:19 (2 d)
Engine
blob
Format
Raw Data
Handle
22199037
Attached To
R3600 invenio-infoscience
pages_number_field.py
View Options
from
wtforms
import
TextField
__all__
=
[
'PagesNumberField'
]
class
PagesNumberField
(
TextField
):
def
__init__
(
self
,
**
kwargs
):
self
.
_icon_html
=
'<i class="icon-th"></i>'
super
(
PagesNumberField
,
self
)
.
__init__
(
**
kwargs
)
def
pre_validate
(
self
):
value
=
self
.
data
def
is_number
(
s
):
try
:
float
(
s
)
return
True
except
ValueError
:
return
False
if
not
is_number
(
value
):
return
dict
(
error
=
1
,
\
error_message
=
'Pages number must be a number! duh'
)
def
autocomplete
(
self
):
return
[]
Event Timeline
Log In to Comment