Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91118627
publisher_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, 02:42
Size
899 B
Mime Type
text/x-python
Expires
Sun, Nov 10, 02:42 (2 d)
Engine
blob
Format
Raw Data
Handle
22200129
Attached To
R3600 invenio-infoscience
publisher_field.py
View Options
from
wtforms
import
TextField
from
invenio.sherpa_romeo
import
SherpaRomeoSearch
from
wtforms.validators
import
Required
__all__
=
[
'PublisherField'
]
class
PublisherField
(
TextField
):
def
__init__
(
self
,
**
kwargs
):
self
.
_icon_html
=
'<i class="icon-certificate"></i>'
# Create our own Required data member
# for client-side use
print
"awesome: s"
print
kwargs
if
kwargs
.
has_key
(
'validators'
):
print
'has attribute'
for
v
in
kwargs
.
get
(
"validators"
):
if
type
(
v
)
is
Required
:
self
.
required
=
True
super
(
PublisherField
,
self
)
.
__init__
(
**
kwargs
)
def
pre_validate
(
self
):
return
dict
(
error
=
0
,
error_message
=
''
)
def
autocomplete
(
self
):
value
=
self
.
data
s
=
SherpaRomeoSearch
()
response
=
s
.
search_publisher
(
value
)
return
response
Event Timeline
Log In to Comment