当前位置: 首页>>代码示例>>Python>>正文


Python DBSession.commit方法代码示例

本文整理汇总了Python中sys2do.model.DBSession.commit方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.commit方法的具体用法?Python DBSession.commit怎么用?Python DBSession.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sys2do.model.DBSession的用法示例。


在下文中一共展示了DBSession.commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: m_events_update

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
def m_events_update():
    id = _g("id")
    if not id :
        flash("No id supplied !", MESSAGE_ERROR)
        return redirect(url_for("m_events_list"))
    action_type = _g("action_type")
    if not action_type in ["m", "c", "p"]:
        flash("No such action !", MESSAGE_ERROR)
        return redirect(url_for("m_events_list"))

    e = DBSession.query(Events).get(id)
#    e = connection.Events.one({"id" : int(id)})

    if action_type == "m":
        return render_template("m_events_update.html", event = e)
    elif action_type == "c": #cancel       
        e.status = 2
        DBSession.add(Message(subject = u"Cancel Booking Event", user_id = e.user_id,
                              content = u"%s cancel the booking request." % session['user_profile']['name']))
        DBSession.commit()
        return jsonify({"success" : True, "message" : "Update successfully !"})
    elif action_type == "p": #confirmed
        e.status = 1
        DBSession.add(Message(subject = u"Confirm Booking Event", user_id = e.user_id,
                              content = u"%s confirm the booking request." % session['user_profile']['name']))
        DBSession.commit()
        return jsonify({"success" : True, "message" : "Update successfully !"})
开发者ID:LamCiuLoeng,项目名称:V3,代码行数:29,代码来源:manage.py

示例2: out_note_delete

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
    def out_note_delete(self):
        id = _g("id")
        if not id :
            flash(MSG_NO_ID_SUPPLIED, MESSAGE_ERROR)
            return redirect(url_for(".view", action = "out_note"))
        try:
            note = DBSession.query(InventoryOutNote).get(id)
            note.active = 1
            for d in note.details:
                location_item = DBSession.query(InventoryLocationItem).filter(and_(InventoryLocationItem.active == 0,
                                                               InventoryLocationItem.location_id == d.location_id,
                                                               InventoryLocationItem.item_id == d.item_id)).with_lockmode("update").one()
                if note.status == 1 :  # the record is not approved
                    location_item.qty += d.qty
                    location_item.area += d.area
                    location_item.weight += d.weight
                location_item.exp_qty += d.qty
                location_item.exp_area += d.area
                location_item.exp_weight += d.weight

            DBSession.add(SystemLog(
                                    type = InventoryOutNote.__class__.__name__,
                                    ref_id = note.id,
                                    remark = u"%s 删除该记录。" % (session['user_profile']['name'])
                                    ))

            DBSession.commit()
            flash(MSG_DELETE_SUCC, MESSAGE_INFO)
        except:
            _error(traceback.print_exc())
            DBSession.rollback()
            flash(MSG_SERVER_ERROR, MESSAGE_ERROR)
        return redirect(url_for(".view", action = "out_note"))
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:35,代码来源:inventory.py

示例3: register

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
def register():
    fields = ["email", "password", "repassword"]
    if _check_params(fields) != 0:
        return jsonify({"result": 0, "msg": MSG_PARAMS_MISSING})

    email = _g("email")
    password = _g("password")
    repassword = _g("repassword")

    if not email:
        return jsonify({"result": 0, "msg": MSG_EMAIL_BLANK_ERROR})
    if not password:
        return jsonify({"result": 0, "msg": MSG_PASSWORD_BLANK_ERROR})
    if password != repassword:
        return jsonify({"result": 0, "msg": MSG_PASSWORD_NOT_MATCH})

    try:
        DBSession.query(User).filter(and_(User.active == 0, func.upper(User.email) == email.upper())).one()
        return jsonify({"result": 0, "msg": MSG_EMAIL_EXIST})
    except:
        traceback.print_exc()
        pass
    display_name = _g("display_name") or email
    try:
        u = User(email=email, password=password, display_name=display_name)
        DBSession.add(u)
        DBSession.commit()
        return jsonify({"result": 1, "msg": MSG_SAVE_SUCCESS, "id": u.id, "point": u.point})
    except:
        traceback.print_exc()
        return jsonify({"result": 0, "msg": MSG_SERVER_ERROR})
开发者ID:LamCiuLoeng,项目名称:V3,代码行数:33,代码来源:api.py

示例4: saveNewApp

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
 def saveNewApp(self):
     appName, appDesc = _gs('appName', 'appDesc')
     if not appName:
         flash(MSG_NO_APP_NAME, MESSAGE_WARNING)
         return redirect(url_for('.view', action = 'createApp'))
     try:
         DBSession.query(AppObject).filter(and_(AppObject.active == 0,
                                         AppObject.name == appName)).one()
     except:
         try:
             app = AppObject(name = appName, desc = appDesc)
             DBSession.add(app)
             DBSession.flush()
             url = createApp(session['user_profile']['id'],
                                 APP_FOLDER, APP_PACKAGE,
                                 'app%s' % app.id, app.name)
             if not url : raise Exception('App generation error!')
             url = '%s%s' % (WEBSITE_ROOT, url)
             imgFile = createQR(url)
             if not imgFile : raise Exception('QR code generation error!')
             DBSession.add(imgFile)
             app.appfile = imgFile
             DBSession.commit()
             flash(MSG_SAVE_SUCC, MESSAGE_INFO)
             self._updateAppInSession()
             return redirect(url_for('.view'))
         except:
             DBSession.rollback()
             flash(MSG_SERVER_ERROR, MESSAGE_ERROR)
             return redirect(url_for('.view'))
     else:
         flash(MSG_APP_NAME_DUPLICATED, MESSAGE_WARNING)
         return redirect(url_for('.view', action = 'createApp'))
开发者ID:LamCiuLoeng,项目名称:appwebsite,代码行数:35,代码来源:consoles.py

示例5: save_register

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
def save_register():
    cid = _g('customer_id' , None)
    user_params = {
                "name" : _g('name'),
                "password" : _g('password'),
                "email" : _g('email'),
                "first_name" : _g('first_name'),
                "last_name" : _g('last_name'),
                "phone" : _g('phone'),
                "mobile" : _g('mobile'),
                   }


    if cid and cid != 'OTHER':
        c = DBSession.query(Customer).get(cid)
        user_params['customer_profile_id'] = c.profile.id
    else:
        cname = _g('name').strip()
        cp = CustomerProfile(name = "PROFILE_%s" % cname.strip().upper().replace(' ', '_'))
        DBSession.add(cp)
        DBSession.flush()
        c = Customer(
                     name = cname,
                     address = _g('address'),
                     profile = cp
                     )
        user_params['customer_profile_id'] = cp.id
        DBSession.add(c)

    DBSession.add(User(**user_params))

    DBSession.commit()
    flash(MSG_SAVE_SUCC, MESSAGE_INFO)
    return redirect(url_for('bpAuth.login'))
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:36,代码来源:auth.py

示例6: save_new

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
    def save_new(self):
        try:
            obj = Customer(
                            no = _g('no'),
                            name = _g('name'),
                            display_name = _g('display_name'),
                            province_id = _g('province_id'),
                            city_id = _g('city_id'),
                            address = _g('address'),
                            contact_person = _g('contact_person'),
                            mobile = _g('mobile'),
                            phone = _g('phone'),
                            email = _g('email'),
                            remark = _g('remark'),
                            note_id = _g('note_id'),
#                            payment_id = _g('payment_id'),
                                )
            DBSession.add(obj)
            obj.attachment = multiupload()
            DBSession.commit()
            flash(MSG_SAVE_SUCC, MESSAGE_INFO)
            return redirect(url_for('.view', action = 'view', id = obj.id))
        except:
            _error(traceback.print_exc())
            DBSession.rollback()
            flash(MSG_SERVER_ERROR, MESSAGE_ERROR)
            return redirect(url_for('.view'))
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:29,代码来源:customer.py

示例7: save_events

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
def save_events():
    uid = request.values.get("uid", None)
    did = request.values.get("did", None)
    d = request.values.get("d", None)
    t = request.values.get("t", None)

    if not uid or not did or not d or not t:
        return jsonify({"success": False, "message": "The required info is not supplied !"})
    format_date = lambda v: "-".join([v[:4], v[4:6], v[-2:]])

    try:
        e = Events(user_id=uid, doctor_id=did, date=d, time=t, remark=request.values.get("remark", None))
        DBSession.add(e)
        doctor = DBSession.query(DoctorProfile).get(did).getUserProfile()
        m = Message(
            subject=u"Booking request submit",
            user_id=session["user_profile"]["id"],
            content=u"%s make a booking with doctor %s at %s , %s."
            % (session["user_profile"]["name"], doctor["name"], t, format_date(d)),
        )
        DBSession.add(m)
        DBSession.commit()
        return jsonify({"success": True, "message": "Save your request successfully !", "event_time": e.time})
    except:
        DBSession.rollback()
        app.logger.error(traceback.format_exc())
        return jsonify({"success": False, "message": "Error occur when submiting the request !"})
开发者ID:LamCiuLoeng,项目名称:V3,代码行数:29,代码来源:action.py

示例8: upload

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
    def upload(self, file_name):
        try:
            f = self.request.files[file_name][0]
            original_fname = f['filename']
            extension = os.path.splitext(original_fname)[1].lower()
            fname = Date2Text(dateTimeFormat = "%Y%m%d%H%M%S", defaultNow = True) + ''.join(random.choice(string.ascii_lowercase + string.digits) for x in range(6))
            final_filename = fname + extension

            d = os.path.join(self.application.settings.get("static_path"),
                             self.application.settings.get("upload_relative_path"))
            if not os.path.exists(d):
                os.makedirs(d)
            full_path = os.path.join(d, final_filename)
            output_file = open(full_path, 'wb')
            output_file.write(f['body'])
            output_file.close()

            DBSession.add(Attachment(name = final_filename, path = full_path, original_name = original_fname,
                                     url = self.static_url("/".join([self.application.settings.get("upload_relative_path"), final_filename]))))
            DBSession.commit()
            return (0, original_fname, final_filename, full_path)
        except:
            DBSession.rollback()
            logging.error(traceback.print_exc())
            return (1, None, None, None)
开发者ID:LamCiuLoeng,项目名称:BookStore,代码行数:27,代码来源:base.py

示例9: save_update

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
    def save_update(self):
        id = _g('id', None)
        if not id :
            flash(MSG_NO_ID_SUPPLIED, MESSAGE_ERROR)
            return redirect(url_for('.view'))
        obj = DBSession.query(Customer).get(id)
        if not obj :
            flash(MSG_RECORD_NOT_EXIST, MESSAGE_ERROR)
            return redirect(url_for('.view'))
        try:
            fields = ['no', 'name', 'display_name', 'province_id', 'city_id',
                      'address', 'contact_person', 'mobile', 'phone', 'email', 'note_id', 'remark']
            old_info = obj.serialize(fields) # to used for the history log
            for f in fields:
                setattr(obj, f, _g(f))

            #handle the file upload
            old_attachment_ids = map(lambda (k, v) : v, _gp("old_attachment_"))
            old_attachment_ids.extend(multiupload())
            obj.attachment = old_attachment_ids

            DBSession.commit()
            flash(MSG_SAVE_SUCC, MESSAGE_INFO)
#            return redirect(url_for('.view',id=obj.id))
            new_info = obj.serialize(fields)
            change_result = obj.compare(old_info, new_info)
            obj.insert_system_logs(change_result)
        except:
            _error(traceback.print_exc())
            DBSession.rollback()
            flash(MSG_SERVER_ERROR, MESSAGE_ERROR)
        return redirect(url_for('.view', action = "view", id = obj.id))
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:34,代码来源:customer.py

示例10: permission

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
 def permission(self):
     method = _g('m', 'LIST')
     if method not in ['LIST', 'NEW', 'UPDATE', 'DELETE', 'SAVE_NEW', 'SAVE_UPDATE']:
         flash(MSG_NO_SUCH_ACTION, MESSAGE_ERROR);
         return redirect(url_for('.view', action = 'index'))
     if method == 'LIST':
         page = _g('page') or 1
         objs = DBSession.query(Permission).filter(Permission.active == 0).order_by(Permission.name).all()
         def url_for_page(**params): return url_for('bpAdmin.view', action = 'permission', m = 'LIST', page = params['page'])
         records = paginate.Page(objs, page, show_if_single_page = True, items_per_page = PAGINATE_PER_PAGE, url = url_for_page)
         return render_template('admin/permission_index.html', records = records)
     elif method == 'NEW':
         groups = Group.all()
         return render_template('admin/permission_new.html', groups = groups)
     elif method == 'UPDATE':
         id = _g('id', None)
         if not id :
             flash(MSG_NO_ID_SUPPLIED, MESSAGE_ERROR)
             return redirect(url_for('.view', action = 'permission'))
         obj = Permission.get(id)
         if not obj :
             flash(MSG_RECORD_NOT_EXIST, MESSAGE_ERROR)
             return redirect(url_for('.view', action = 'permission'))
         gids = map(lambda v:v.id, obj.groups)
         all_groups = Group.all()
         return render_template('admin/permission_update.html', v = obj.populate(), gids = gids, all_groups = all_groups)
     elif method == 'DELETE':
         id = _g('id', None)
         if not id :
             flash(MSG_NO_ID_SUPPLIED, MESSAGE_ERROR)
             return redirect(url_for('.view', action = 'permission'))
         obj = Permission.get(id)
         if not obj :
             flash(MSG_RECORD_NOT_EXIST, MESSAGE_ERROR)
             return redirect(url_for('.view', action = 'permission'))
         obj.active = 1
         obj.groups = []
         DBSession.commit()
         flash(MSG_DELETE_SUCC, MESSAGE_INFO)
         return redirect(url_for('.view', action = 'permission'))
     elif method == 'SAVE_NEW':
         obj = Permission.saveAsNew(request.values)
         obj.groups = DBSession.query(Group).filter(Group.id.in_(_gl("gids"))).all()
         DBSession.commit()
         flash(MSG_SAVE_SUCC, MESSAGE_INFO)
         return redirect(url_for('.view', action = 'permission'))
     elif method == 'SAVE_UPDATE':
         id = _g('id', None)
         if not id :
             flash(MSG_NO_ID_SUPPLIED, MESSAGE_ERROR)
             return redirect(url_for('.view', action = 'permission'))
         obj = Permission.get(id)
         if not obj :
             flash(MSG_RECORD_NOT_EXIST, MESSAGE_ERROR)
             return redirect(url_for('.view', action = 'permission'))
         obj.saveAsUpdate(request.values)
         obj.groups = DBSession.query(Group).filter(Group.id.in_(_gl('gids'))).all()
         obj.commit()
         flash(MSG_UPDATE_SUCC, MESSAGE_INFO)
         return redirect(url_for('.view', action = 'permission'))
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:62,代码来源:admin.py

示例11: saveProfile

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
 def saveProfile(self):
     uid = session['user_profile']['id']
     user = DBSession.query(User).get(uid)
     user.mobile = _g('mobile')
     DBSession.commit()
     flash(MSG_SAVE_SUCC, MESSAGE_INFO)
     return redirect(url_for('.view'))
开发者ID:LamCiuLoeng,项目名称:appwebsite,代码行数:9,代码来源:consoles.py

示例12: saveNewArticle

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
    def saveNewArticle(self):
        appid, title, sub_title, validate_date, desc, content = _gs('appid', 'title', 'sub_title', 'validate_date', 'desc', 'content')
        if not appid :
            flash(MSG_NO_ID_SUPPLIED, MESSAGE_WARNING)
            return redirect(url_for('.view'))

        if not title:
            flash(MSG_NO_ENOUGH_PARAMS, MESSAGE_WARNING)
            return redirect(url_for('.view', action = 'createArticle', appid = appid))

        try:
            article = AppArticle(
                             app_id = appid,
                             title = title,
                             sub_title = sub_title,
                             desc = desc,
                             content = content,
                             validate_date = validate_date,
                             )
            DBSession.add(article)
            DBSession.flush()
            article.seq = article.id
            DBSession.commit()
            flash(MSG_SAVE_SUCC, MESSAGE_INFO)
            return redirect(url_for(".view", action = "listArticle", appid = appid))
        except:
            DBSession.rollback()
            flash(MSG_SERVER_ERROR, MESSAGE_ERROR)
            traceback.print_exc()
            return redirect(url_for(".view", action = "listArticle", appid = appid))
开发者ID:LamCiuLoeng,项目名称:appwebsite,代码行数:32,代码来源:consoles.py

示例13: init

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
def init():
    try:
        print "create tables"
        metadata.drop_all(engine, checkfirst = True)
        metadata.create_all(engine)

        print "insert default value"
        DBSession.add(User(name = 'demo', password = 'demo'))

        for code in range(9121, 9140):
            DBSession.add(NFCData(authcode = unicode(code), company = 'RoyalDragonVodka',
                                  serial = code - 9000,
                                  ))
        f = open('country.txt', 'r')
        cs = f.readlines()
        f.close()
        for c in cs:
            n, c, iso = c.split('|')
            DBSession.add(MLocation(name = n, iso_code = iso, code = c))

        DBSession.commit()
        print "finish init!"
    except:
        traceback.print_exc()
        DBSession.rollback()
开发者ID:LamCiuLoeng,项目名称:nfcdemo,代码行数:27,代码来源:init.py

示例14: import_supplier

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
def import_supplier(payment1):
    print "insert supplier"
    DBSession.add_all([
               Supplier(name = u'中深翔', display_name = u'中深翔', address = u'布吉丹竹头金鹏物流园A区A栋18-20号', mobile = '13600432849', contact_person = u'全总', remark = u'上海', payment = payment1),
               Supplier(name = u'深中联', display_name = u'深中联', address = u'布吉丹竹头金鹏物流园A栋5-6号', mobile = '13392826777,18902480211', contact_person = u'王总,丁小姐', remark = u'温州、台州、温岭、临海、黄岩', payment = payment1),
               Supplier(name = u'旺平达', display_name = u'旺平达', address = u'龙华明治大道华通源物流中心B2栋263-266号', mobile = '15099917300', contact_person = u'李飞章', remark = u'苏州、无锡、昆山、张家港、宜兴、常熟、太仓、吴江', payment = payment1),
               Supplier(name = u'顺福', display_name = u'顺福', address = u'丹竹头白泥坑宇达物流园3栋301-318号', phone = '89575677', mobile = '13316895558', contact_person = u'陈老板', remark = u'徐州、南通、淮安、盐城、连云港、启东', payment = payment1),
               Supplier(name = u'鑫金叶', display_name = u'鑫金叶', address = u'布吉李朗东西干道南岭大龙山物流园G栋1-3号', mobile = '13906667228', contact_person = u'金经理        ', remark = u'温州苍南', payment = payment1),
               Supplier(name = u'华发', display_name = u'华发', address = u'金鹏物流园B区9栋7-12号', mobile = '15999677737', contact_person = u' 陈老板', remark = u'南京、常州、扬州、泰州、镇江、靖江', payment = payment1),
               Supplier(name = u'京鹏', display_name = u'京鹏', address = u'华通源物流中心C4栋138-152号', mobile = '13066815788,13066815788', contact_person = u'老板娘           傅总', remark = u'杭州、上虞、湖州、德清、临安、丽水、桐乡、长兴、云南省', payment = payment1),
               Supplier(name = u'凯林瑞', display_name = u'凯林瑞', address = u'龙岗区丹竹头金鹏物流园B区D栋41-42号', phone = '0755-82432843', mobile = '', contact_person = u'杨总', remark = u'浙江嘉兴', payment = payment1),
               Supplier(name = u'海联', display_name = u'海联', address = u'华通源物流中心', mobile = '18688838882', contact_person = u'李老板', remark = u'宁波、义乌、绍兴、衢州、诸暨、金华、慈溪、余姚、舟山、奉化', payment = payment1),
               Supplier(name = u'荣晖', display_name = u'荣晖', address = u'金鹏A区B栋15-18号,40-42号', mobile = '13631528080', contact_person = u'胡总', remark = u'南昌、赣州、新余、吉安、九江、萍乡、宜春、鹰潭', payment = payment1),
               Supplier(name = u'深湘', display_name = u'深湘', address = u'长城货代市场83档', mobile = '13902485137', contact_person = u'丘总', remark = u'长沙、常德、衡阳、株洲、湘阴、岳阳、怀化、湘潭', payment = payment1),
               Supplier(name = u'澳跃', display_name = u'澳跃', address = u'金鹏', mobile = '13902311565', contact_person = u'肖总', remark = u'武汉、黄冈、黄石、荆州、咸宁、孝感、襄樊、恩施、十堰、襄阳', payment = payment1),
               Supplier(name = u'金鹏行', display_name = u'金鹏行', address = u'', mobile = '18926534999', contact_person = u'俞总', remark = u'合肥、淮南、黄山、桐城、芜湖、宣城、安庆、铜陵、涡阳、滁州、怀远', payment = payment1),
               Supplier(name = u'京鹏', display_name = u'京鹏', address = u'华通源物流中心C4栋138-152号', mobile = '13066815788', contact_person = u'傅小姐', remark = u'昆明、大理、曲靖、景洪', payment = payment1),
               Supplier(name = u'鑫辉', display_name = u'鑫辉', address = u'布吉丹平路闽鹏程货运市场11栋1-4号', mobile = '13925234059', contact_person = u'刘先生', remark = u'龙岩、三明', payment = payment1),
               Supplier(name = u'广运物流', display_name = u'广运物流', address = u'龙岗丹竹头闽鹏程货运市场5栋29-30号', mobile = '18923724600', contact_person = u'徐先生', remark = u'顺德', payment = payment1),
               Supplier(name = u'金华航', display_name = u'金华航', address = u'华通源物流园', phone = '0755-23022756', mobile = '', contact_person = u'刘先生', remark = u'中山', payment = payment1),
               Supplier(name = u'速速达', display_name = u'速速达', address = u'龙岗区布吉上李朗方鑫路22号速速达物流', phone = None, mobile = '13392831936', contact_person = u'王晓刚', remark = u'南宁、桂林、柳州、钦州', payment = payment1),
               Supplier(name = u'盛丰', display_name = u'盛丰', address = u'龙岗区南湾街道吉厦社区早禾坑工业区15号A栋', phone = None, mobile = '13798363667', contact_person = u'周总', remark = u'泉州、福州、莆田、福清', payment = payment1),
               Supplier(name = u'美泰', display_name = u'美泰', address = u'龙岗布吉大龙山物流园F栋10号美泰物流', phone = None, mobile = '18926795962', contact_person = u'毛主管', remark = u'广州', payment = payment1),
               Supplier(name = u'凯利', display_name = u'凯利', address = u'布吉单竹头金鹏物流园B区E栋1-5号 ', phone = '61217611,61217600', mobile = '', contact_person = u'熊小姐', remark = u'三亚、海口、琼海、万宁', payment = payment1),
               Supplier(name = u'骏兴顺', display_name = u'骏兴顺', address = u'龙华民治大道华通源物流中心C1栋58-60号', phone = None, mobile = '15914055308', contact_person = u'曾经理', remark = u'贵阳、金沙、安顺', payment = payment1),
               Supplier(name = u'澳跃', display_name = u'澳跃', address = u'金鹏A区栋13-15号', phone = None, mobile = '18923411132', contact_person = u'李峰', remark = u'漳州', payment = payment1),
               Supplier(name = u'勤威', display_name = u'勤威', address = u'金鹏B区C栋33号', phone = None, mobile = '13728866595', contact_person = u'石总', remark = u'厦门', payment = payment1),
               ])
    DBSession.commit()
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:31,代码来源:init.py

示例15: save_new

# 需要导入模块: from sys2do.model import DBSession [as 别名]
# 或者: from sys2do.model.DBSession import commit [as 别名]
    def save_new(self):
        params = {
                   "name" : _g('name'),
                   "address" : _g('address'),
                   "manager" : _g('manager'),
                   "remark" : _g('remark'),
                   "parent_id" : _g('parent_id'),
                  }

        try:
            obj = InventoryLocation(**params)
            DBSession.add(obj)
            DBSession.flush()

            if params['parent_id']:
                parent = DBSession.query(InventoryLocation).get(obj.parent_id)
                obj.full_path = "%s%s" % (parent.full_path or '', params['name'])
                obj.full_path_ids = "%s|%s" % (parent.full_path_ids, obj.id)
            else:
                obj.full_path = params['name']
                obj.full_path_ids = obj.id

            DBSession.commit()
            flash(MSG_SAVE_SUCC, MESSAGE_INFO)
        except:
            DBSession.rollback()
            _error(traceback.print_exc())
        return redirect(self.default())
开发者ID:LamCiuLoeng,项目名称:Logistics,代码行数:30,代码来源:warehouse.py


注:本文中的sys2do.model.DBSession.commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。