#NEWLINE# @ web . removeslash #NEWLINE# def get( self ) : #NEWLINE# #INDENT# if ( not self . current_user ) : #NEWLINE# #INDENT# self . json ( { #NEWLINE# #INDENT# 'error' : 'Forbidden!' , #NEWLINE# 'time' : round ( self . request . request_time ( ) , 3 ) , #NEWLINE# #UNINDENT# } , 403 ) #NEWLINE# return #NEWLINE# #UNINDENT# ester_id = self . get_argument ( 'ester_id' , default = '' , strip = True ) . strip ( 'bx. ' ) [ : 7 ] #NEWLINE# if ( not ester_id ) : #NEWLINE# #INDENT# self . json ( { #NEWLINE# #INDENT# 'error' : 'No ester ID!' , #NEWLINE# 'time' : round ( self . request . request_time ( ) , 3 ) , #NEWLINE# #UNINDENT# } , 400 ) #NEWLINE# return #NEWLINE# #UNINDENT# sql = ( "\n            SELECT\n                '%s' AS id,\n                property.entity_id AS entity,\n                entity.entity_definition_keyname AS definition\n            FROM\n                property,\n                entity,\n                property_definition\n            WHERE entity.id = property.entity_id\n            AND property_definition.keyname = property.property_definition_keyname\n            AND property_definition.dataproperty = 'ester-id'\n            AND LEFT(REPLACE(REPLACE(REPLACE(property.value_string, '.', ''), 'b', ''), ' ', ''), 7) = '%s'\n            AND property.is_deleted = 0\n            AND entity.is_deleted = 0\n            AND property_definition.is_deleted = 0\n            LIMIT 1;\n        " % ( self . get_argument ( 'id' , default = '' , strip = True ) , ester_id ) ) #NEWLINE# entity = self . db_get ( sql ) #NEWLINE# if entity : #NEWLINE# #INDENT# self . json ( { #NEWLINE# #INDENT# 'result' : entity , #NEWLINE# 'time' : round ( self . request . request_time ( ) , 3 ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . json ( { #NEWLINE# #INDENT# 'time' : round ( self . request . request_time ( ) , 3 ) , #NEWLINE# #UNINDENT# } , 404 )