auth_token = { "identity": { "appId": "A:fillin:yourcred" }, "auth": { "key": "a-fillin-yourcred", "token": "FILLINYOURTKENHERE" } } class AuthToken: def __init__(self, name, json): self.name = name self.datatype = 'JSON' self.description = 'AuthToken' self.value = json def to_metadata(self): meta = { 'name': self.name, 'dataType': self.datatype, 'description': self.description, 'value': self.value } return meta #db.unregister_constants('auth_token') db.register_constants([AuthToken('auth_token', auth_token)])
''' Constants are defined by identifying the UI control that will manager them. Constants may either be scalars or arrays. Single valued (scalars) will be managed using single line edit, which is derived from the UISingle class. ''' gamma = UISingle(name='gamma', description= 'Sample single valued parameter', datatype=float) ''' Arrays are managed using a multi-select control ''' zeta = UIMulti(name='zeta', description= 'Sample multi-valued array', values = ['A','B','C'], datatype = str ) ''' Use the register_constants method on the Database object to make constants available in the UI ''' db.register_constants([gamma,zeta])