def post(self): c_ID = self.request.get('con_id') _con = Contention.get_by_id(int(c_ID)) branch_name = self.request.get('branch') elem_type = self.request.get('etype') parent_type = self.request.get('ptype') content = self.request.get('content') step = int(self.request.get('step')) + 1 e = Elements(contention_key=_con, g_frame=step) if parent_type == "con": e.top_level = 1 else: e.parent_id = int(self.request.get('pid')) e.content = content e.branch_name = branch_name e.element_type = elem_type logging.info("etype= " + elem_type) e.parent_t = parent_type if self.logged_in: logging.info('Checking currently logged in user') logging.info(self.current_user.name) sessiony = self.auth.get_user_by_session() e.author = self.current_user.name e.author_id = sessiony['user_id'] e.put() _con.g_frames = step _con.put()
def post(self): c_ID = self.request.get('con_id') _con = Contention.get_by_id(int(c_ID)) branch_name = self.request.get('branch') elem_type = self.request.get('etype') parent_type = self.request.get('ptype') pid = self.request.get('pid') content = self.request.get('content') ss = int(self.request.get('ss')) elems = _con.elements e=Elements() contot = _con.tot_element_code updated_codes = element_code_update(pid,contot) e.element_id = updated_codes['element_id'] e.parent_id = pid e.content = content e.sure_score = ss e.branch_name = branch_name e.element_type = elem_type #logging.info("etype= "+elem_type) e.parent_t=parent_type if self.logged_in: logging.info('Checking currently logged in user') logging.info(self.current_user.name) sessiony = self.auth.get_user_by_session() e.author = self.current_user.name e.author_id = sessiony['user_id'] step=int(self.request.get('step'))+1 _con.g_frame=step _con.tot_element_code = updated_codes['tot_element_code'] elems.append(e) _con.elements = elems _con.put() user_ID = sessiony['user_id'] u = User.get_by_id(int(user_ID)) cid = _con.key.id() ckey = _con.key g = GPoints() uid = u.key.id() ukey = ndb.Key(User, uid) logging.info("key id = " + str(uid )) logging.info("ndb key = ") logging.info(ukey) g.user_key = ukey g.user_name = self.current_user.name g.points_log = "Posted " + elem_type g.contention_key = ckey g.contention_id = cid g.element_id = updated_codes['element_id'] g.branch_name = branch_name g.points = 10 g.elem_type = elem_type g.content = content g.put() logging.info('+++++++++++++++++report 1 for con id ='+ c_ID + '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') logging.info(_con.elements) logging.info('++++++++++++++++++end report 1+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') newcon = Contention.get_by_id(int(c_ID)) logging.info('+++++++++++++++++report 2 for con id ='+ c_ID + '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') for i in newcon.elements: logging.info(i.element_id) logging.info(i.content) logging.info(newcon.elements) logging.info('++++++++++++++++++end report 2+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++') self.redirect('/cv?con_id=%s' % _con.key.id())