def single_good_add(pars): condition = fun.warp_data(pars) condition['create_date'] = fun.now() del condition['id'] print 'condition = ', condition try: g = Good(**condition) g.save() return True except Exception as e: print e return False
def user_register(pars): if pars['passwd'] != pars['repasswd']: return -1 condition = fun.warp_data(pars) del condition['repasswd'] condition['create_date'] = fun.now() condition['passwd'] = fun.mk_md5(condition['passwd']) print 'condition = ', condition try: r = User.objects.get(email=condition['email']) if r: return -2 except User.DoesNotExist: try: u = User(**condition) u.save() if u.name: return 1 else: return -3 except: return -2
def user_register(pars): if pars['passwd']!=pars['repasswd']: return -1 condition = fun.warp_data(pars) del condition['repasswd'] condition['create_date'] = fun.now() condition['passwd'] = fun.mk_md5(condition['passwd']) print 'condition = ',condition try: r = User.objects.get(email=condition['email']) if r: return -2 except User.DoesNotExist: try: u = User(**condition) u.save() if u.name: return 1 else: return -3 except: return -2