예제 #1
0
 def update(self, **argv):
     self.dname = argv.get('dessert_name', self.dname)
     self.type_id = argv.get('type', self.type_id)
     self.des = argv.get('des', self.des)
     self.num = argv.get('num', self.num)
     self.price = argv.get('price', self.price)
     session.commit()
예제 #2
0
 def update(self, **argv):
     self.dname = argv.get('dessert_name', self.dname)
     self.type_id = argv.get('type', self.type_id)
     self.des = argv.get('des', self.des)
     self.num = argv.get('num', self.num)
     self.price = argv.get('price', self.price)
     session.commit()
예제 #3
0
 def change_perms(self, d_perms=None, a_perms=None):
     if d_perms:
         for perm in d_perms:
             self.perms.remove(perm)
     if a_perms:
         for perm in a_perms:
             self.perms.append(perm)
     session.commit()
예제 #4
0
 def change_perms(self, d_perms=None, a_perms=None):
     if d_perms:
         for perm in d_perms:
             self.perms.remove(perm)
     if a_perms:
         for perm in a_perms:
             self.perms.append(perm)
     session.commit()
예제 #5
0
 def update(self, **argv):
     from models.perm import Permission
     self.rolename = argv.get('rolename', self.rolename)
     if 'perms' in argv:
         perms_to_add = argv['perms']['add'] and Permission.get_mul(argv['perms']['add']) or None
         perms_to_remove = argv['perms']['remove'] and Permission.get_mul(argv['perms']['remove']) or None
         self.change_perms(perms_to_remove, perms_to_add)
     session.commit()
예제 #6
0
 def change_roles(self, d_roles=None, a_roles=None):
     if d_roles:
         for role in d_roles:
             self.roles.remove(role)
     if a_roles:
         for role in a_roles:
             self.roles.append(role)
     session.commit()
예제 #7
0
 def update(self, **argv):
     from models.perm import Permission
     self.rolename = argv.get('rolename', self.rolename)
     if 'perms' in argv:
         perms_to_add = argv['perms']['add'] and Permission.get_mul(
             argv['perms']['add']) or None
         perms_to_remove = argv['perms']['remove'] and Permission.get_mul(
             argv['perms']['remove']) or None
         self.change_perms(perms_to_remove, perms_to_add)
     session.commit()
예제 #8
0
def register(**argv):
  user = session.query(User).filter_by(username=argv["username"]).first()
  if user:
    return False, "username exist"
  user = User(username=argv["username"], password=argv["password"])
  session.add(user)
  session.commit()
  s = request.environ.get('beaker.session')
  s['user'] = user.id
  return True, "success"
예제 #9
0
def register(**argv):
    user = session.query(User).filter_by(username=argv["username"]).first()
    if user:
        return False, "username exist"
    user = User(username=argv["username"], password=argv["password"])
    session.add(user)
    session.commit()
    s = request.environ.get('beaker.session')
    s['user'] = user.id
    return True, "success"
예제 #10
0
def random_order_g():
    global order_buffer
    global oi_buffer
    start_date = dt(2012, 1, 1) 
    end_date = dt(2012, 4, 2)
    for i, single_date in enumerate(daterange(start_date, end_date)):
        for num in range(random.randint(i+20, i+40)): 
            random_order(single_date)
        for num in range(random.randint(i+10, i+40)): 
            random_res(single_date)
        print single_date

    session.add_all(order_buffer)
    session.add_all(oi_buffer)
    session.commit()
예제 #11
0
def random_order_g():
    global order_buffer
    global oi_buffer
    start_date = dt(2012, 1, 1)
    end_date = dt(2012, 4, 2)
    for i, single_date in enumerate(daterange(start_date, end_date)):
        for num in range(random.randint(i + 20, i + 40)):
            random_order(single_date)
        for num in range(random.randint(i + 10, i + 40)):
            random_res(single_date)
        print single_date

    session.add_all(order_buffer)
    session.add_all(oi_buffer)
    session.commit()
예제 #12
0
 def update(self, **argv):
     from models.role import Role
     self.username = argv.get('username', self.username)
     self.password = argv.get('password', self.password)
     self.type_id = argv.get('type', self.type_id)
     self.age = argv.get('age', self.age)
     self.address = argv.get('address', self.address)
     self.email = argv.get('email', self.email)
     self.gender = argv.get('gender', self.gender)
     if 'roles' in argv:
         roles_to_add = argv['roles']['add'] and Role.get_mul(argv['roles']['add']) or None
         roles_to_remove = argv['roles']['remove'] and Role.get_mul(argv['roles']['remove']) or None
         self.change_roles(roles_to_remove, roles_to_add)
     if 'recharge' in argv:
         self.recharge(argv['recharge'])
     session.commit()
예제 #13
0
    def update(self, **argv):

        self.user_id        = argv.get('user', self.user_id)
        self.discount       = argv.get('discount', self.discount)

        self.is_complete    = argv.get('is_complete', self.is_complete)
        self.is_order       = argv.get('is_order', self.is_order) 
        self.is_confirmed   = argv.get('is_confirmed', self.is_confirmed)

        confirm_date = argv.get('confirm_date', None)
        send_date    = argv.get('send_date', None)   
        if send_date:
            self.send_date = str2date(send_date)
        if confirm_date:
            self.confirm_date = str2date(confirm_date)
            if self.is_order:
                self.send_date = self.confirm_date
                self.is_complete = self.is_confirmed
        session.commit()
예제 #14
0
    def update(self, **argv):

        self.user_id = argv.get('user', self.user_id)
        self.discount = argv.get('discount', self.discount)

        self.is_complete = argv.get('is_complete', self.is_complete)
        self.is_order = argv.get('is_order', self.is_order)
        self.is_confirmed = argv.get('is_confirmed', self.is_confirmed)

        confirm_date = argv.get('confirm_date', None)
        send_date = argv.get('send_date', None)
        if send_date:
            self.send_date = str2date(send_date)
        if confirm_date:
            self.confirm_date = str2date(confirm_date)
            if self.is_order:
                self.send_date = self.confirm_date
                self.is_complete = self.is_confirmed
        session.commit()
예제 #15
0
 def delete(self):
     session.delete(self)
     session.commit()
예제 #16
0
 def add(self):
     session.add(self)
     session.commit()
예제 #17
0
 def update(self, **argv):
     self.num = argv.get('num', self.num)
     self.dessert_id = argv.get('dessert', self.dessert_id)
     self.order_id = argv.get('order', self.order_id)
     self.price = argv.get('price', self.price)
     session.commit()
예제 #18
0
 def delete(self):
     session.delete(self)
     session.commit()
예제 #19
0
 def deactivate(self):
     self.is_active = False
     session.commit()
예제 #20
0
 def update(self, **argv):
     self.content = argv.get("content", self.content)
     self.title = argv.get("title", self.title)
     session.commit()
예제 #21
0
 def update(self, **argv):
     self.permname = argv.get('permname', self.permname)
     session.commit()
예제 #22
0
 def update(self, **argv):
     self.typename = argv.get('typename', self.typename)
     self.discount = argv.get('discount', self.discount)
     self.fee = argv.get('fee', self.fee)
     session.commit()
예제 #23
0
 def update(self, **argv):
     self.num = argv.get('num', self.num)
     self.dessert_id = argv.get('dessert', self.dessert_id)
     self.order_id = argv.get('order', self.order_id)
     self.price = argv.get('price', self.price)
     session.commit()
예제 #24
0
 def update(self, **argv):
     self.typename = argv.get('typename', self.typename)
     session.commit()
예제 #25
0
 def update(self, **argv):
     self.permname = argv.get('permname', self.permname)
     session.commit()
예제 #26
0
 def update(self, **argv):
     self.typename = argv.get('typename', self.typename)
     session.commit()
예제 #27
0
 def add(self):
     session.add(self)
     session.commit()
예제 #28
0
 def recharge(self, d=1):
     self.expire_time += td(365 * d)
     session.commit()
예제 #29
0
 def activate(self):
     self.is_active = True
     session.commit()
예제 #30
0
 def update(self, **argv):
     self.content = argv.get('content', self.content)
     self.title = argv.get('title', self.title)
     session.commit()