def as_company(self,dct): c = Company(dct['id']) if dct.has_key('name'): c.name = dct['name'] if dct.has_key('code'): c.code = dct['code'] if dct.has_key('vat_number'): c.vat_number = dct['vat_number'] if dct.has_key('company_types'): c.company_types = [] if(isinstance( (dct['company_types']), int )): c.company_types.append(dct['company_types']); else: for i in dct['company_types']: c.company_types.append(CompanyType.get(i)); return c
def get(self): ct = CompanyType.values() j = json.dumps(ct,cls=MyEncoder1) self.response.write(j)