def noval_signup(self,id=None): log.info('in signup method') poly_data = request.params.get('poly_data') existing_area = request.params.get('existing_area') existing_marker = request.params.get('existing_marker') if type(self).update_mode: #raise Exception('getting activity %s , %s'%(id,request.params)) act = meta.Session.query(Activity).get(id) if not act.user_id==c.user_id: raise Exception('security violation trying to update someone elses s***e') else: act = Activity() act.user = meta.Session.query(User).get(c.user_id) act.activity_type=type(self).activity_type #raise Exception('act user is %s'%act.user) if c.inserted_area: act.area = a = c.inserted_area elif existing_area: log.info('about to commit - existing area is %s'%existing_area) act.area_id = existing_area elif act.activity_type=='courier': raise Exception('no area set to be inserted with this activity!') if c.inserted_marker: act.marker = im = c.inserted_marker elif existing_marker: #act.marker = im = meta.Session.query(Area).get(existing_marker) act.marker_id = existing_marker elif act.activity_type=='business': raise Exception('no location set to be inserted with this activity') #raise Exception('about to insert activity with area %s (area_id %s) , user %s and activity type "%s"'%(act.area,act.area_id,act.user,act.activity_type)) self.add_extra_fields(act) if type(self).update_mode: [meta.Session.delete(sch) for sch in act.schedules] else: meta.Session.add(act) meta.Session.commit() if 'schedule' in self.form_result: for sch in self.form_result['schedule']: scho = Schedule() scho.activity = act meta.Session.add(scho) sch_h = ScheduleHour() sch_h.schedule = scho sch_h.time_from = (sch['h']['fr']) #raise Exception(type(sch['h']['fr'])) sch_h.time_to = (sch['h']['to']) meta.Session.add(sch_h) for dn in sch['d']: sch_d = ScheduleWeekday() sch_d.schedule = scho sch_d.weekday = dn meta.Session.add(sch_d) meta.Session.commit() if type(self).update_mode: return redirect(url.current(controller=act.activity_type,id=act.id,justadded=False)) else: return redirect(url.current(controller=act.activity_type,action='matches_map',id=act.id,justadded=True))