コード例 #1
0
 def form_to_dao(self, playground_id):
   playground = None
   if playground_id is not None  and len(playground_id) > 1:
     playground = self.playgroundDao.get_record(long(playground_id))
   else:
     playground = Playground()
   playground.name = self.form.name.data
   playground.sport = self.form.sport.data.lower()
   #Create an automatic alias for the playground
   playground.alias = utils.slugify(self.form.name.data)
   playground.description = self.form.description.data
   playground.featured = self.form.featured.data
   self.form.address.locality.data = self.form.locality.data   #for locality from basic info to address
   self.form.address.city.data = self.form.city.data   #for city from basic info to address
   playground = cms_utils.form_to_dao_address(self.form, playground)
   playground = cms_utils.form_to_dao_contact_info(self.form, playground)
   return playground
コード例 #2
0
ファイル: import_handler.py プロジェクト: ratana168/eventm
 def form_to_dao_ground(self, alias_name, **update):
     try:
         playground = Playground()
         playground.name = update['name']
         #Create an automatic alias for the playground
         playground.alias = alias_name
         playground.description = update['description']
         playground.sport = update['sport']
         playground = self.form_to_dao_address_import(playground, **update)
         playground = self.form_to_dao_contact_info_import(
             playground, **update)
         #if playground.photos is None:
         #playground.photos = []
         #self.upload_photos(playground.photos)
     except StandardError as e:
         logger.error('Error occured, %s, for %s:%s' %
                      (str(e), type, update['name']))
         raise
     return playground