Commit 7dee9768 by lduarte1991

Removed diacritic mention and explained token

parent 5ae1ca96
...@@ -17,11 +17,16 @@ def retrieve_token(userid, secret): ...@@ -17,11 +17,16 @@ def retrieve_token(userid, secret):
the token was issued. This will be stored with the user along with the token was issued. This will be stored with the user along with
the id for identification purposes in the backend. the id for identification purposes in the backend.
''' '''
#retrieve difference between current time and Greenwich time to assure timezones are normalized
dtnow = datetime.datetime.now() dtnow = datetime.datetime.now()
dtutcnow = datetime.datetime.utcnow() dtutcnow = datetime.datetime.utcnow()
delta = dtnow - dtutcnow delta = dtnow - dtutcnow
#use the new normalized time to retreive the date the token was issued
newhour, newmin = divmod((delta.days * 24 * 60 * 60 + delta.seconds + 30) // 60, 60) newhour, newmin = divmod((delta.days * 24 * 60 * 60 + delta.seconds + 30) // 60, 60)
newtime = "%s%+02d:%02d" % (dtnow.isoformat(), newhour, newmin) newtime = "%s%+02d:%02d" % (dtnow.isoformat(), newhour, newmin)
#uses the issued time, the consumer key and the user's email to maintain a
#federated system in the annotation backend server
custom_data = {"issuedAt": newtime, "consumerKey": secret, "userId": userid, "ttl": 86400} custom_data = {"issuedAt": newtime, "consumerKey": secret, "userId": userid, "ttl": 86400}
newtoken = create_token(secret, custom_data) newtoken = create_token(secret, custom_data)
return newtoken return newtoken
\ No newline at end of file
...@@ -45,12 +45,6 @@ class AnnotatableFields(object): ...@@ -45,12 +45,6 @@ class AnnotatableFields(object):
) )
annotation_storage_url = String(help="Location of Annotation backend", scope=Scope.settings, default="http://your_annotation_storage.com", display_name="Url for Annotation Storage") annotation_storage_url = String(help="Location of Annotation backend", scope=Scope.settings, default="http://your_annotation_storage.com", display_name="Url for Annotation Storage")
annotation_token_secret = String(help="Secret string for annotation storage", scope=Scope.settings, default="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", display_name="Secret Token String for Annotation") annotation_token_secret = String(help="Secret string for annotation storage", scope=Scope.settings, default="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", display_name="Secret Token String for Annotation")
diacritics = String(
display_name="Diacritic Marks",
help= "Add diacritic marks to be added to a text using the comma-separated form, i.e. markname;urltomark;baseline,markname2;urltomark2;baseline2",
scope=Scope.settings,
default='',
)
class TextAnnotationModule(AnnotatableFields, XModule): class TextAnnotationModule(AnnotatableFields, XModule):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment