def get( self ): M = self.get_REST_model_T() if M is not None: if self.get_REST_model_id(): m = self.get_REST_model_instance() if m and m.is_saved(): self.response.out.write( lightcrudmodel.to_format( lightcrudmodel.extract_dict( m ), self.get_format_from_path() ) ) else: lm = [lightcrudmodel.extract_dict( m ) for m in M.all()] if lm: self.response.out.write( lightcrudmodel.to_format( lm, self.get_format_from_path() ) ) else: llmm = [] for modelname in models.bindings.keys(): M = lightcrudmodel.make_kind_of_model_by_name( modelname, 'models' ) # FIX: magic value lm = [lightcrudmodel.extract_dict( m ) for m in M.all()] if lm: llmm.append( lm ) if llmm: self.response.out.write( lightcrudmodel.to_format( llmm, self.get_format_from_path() ) )
def post( self ): m = self.get_REST_model_instance() if m: self.response.out.write( str( lightcrudmodel.extract_dict( m ) ) ) self.response.out.write( lightcrudmodel.to_format( lightcrudmodel.extract_dict( m ), self.get_format_from_path() ) ) m.delete()
def post( self ): m = self.get_REST_model_instance() if m and m.is_saved(): lightcrudmodel.apply_dict( m, self.get_REST_dict() ) m.put() self.response.out.write( lightcrudmodel.to_format( lightcrudmodel.extract_dict( m ), self.get_format_from_path() ) )
def post( self ): m = self.create_REST_model_instance() if m: lightcrudmodel.apply_dict( m, lightcrudmodel.from_format( self.request.body, self.get_format_from_path() ) ) m.put() self.response.out.write( lightcrudmodel.to_format( lightcrudmodel.extract_dict( m ), self.get_format_from_path() ) )