#NEWLINE# def get( self ) : #NEWLINE# #INDENT# parent_entity_id = self . get_argument ( 'parent_entity_id' , default = None , strip = True ) #NEWLINE# entity_definition_keyname = self . get_argument ( 'entity_definition_keyname' , default = None , strip = True ) #NEWLINE# public = ( True if ( self . get_argument ( 'public' , default = None , strip = True ) == 'true' ) else False ) #NEWLINE# user = self . get_user_by_session_key ( self . get_argument ( 'session_key' , default = None , strip = True ) ) #NEWLINE# user_id = None #NEWLINE# if user : #NEWLINE# #INDENT# if ( not user . get ( 'id' ) ) : #NEWLINE# #INDENT# raise web . HTTPError ( 401 , 'Unauthorized' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise web . HTTPError ( 401 , 'Unauthorized' ) #NEWLINE# #UNINDENT# if ( entity_definition_keyname != None ) : #NEWLINE# #INDENT# entity_id = entity . create_entity ( entity_definition_keyname = entity_definition_keyname , parent_entity_id = parent_entity_id ) #NEWLINE# if entity_id : #NEWLINE# #INDENT# entity . set_public ( entity_id , is_public = public ) #NEWLINE# #UNINDENT# self . write ( { #NEWLINE# #INDENT# 'entity_id' : entity_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise web . HTTPError ( 400 , 'To create a new Entity entity_definition_keyname is required.' )