• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python orm.get_model函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中uliweb.orm.get_model函数的典型用法代码示例。如果您正苦于以下问题:Python get_model函数的具体用法?Python get_model怎么用?Python get_model使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: post_save

def post_save(sender, instance, created, data, old_data):
    from uliweb.orm import get_model
    import pickle
    from datetime import datetime
    from uliweb import request
    
    tablename = sender.tablename
    if not need_audit(tablename):
        return

    Audit = get_model('audit')
    Tables = get_model('tables')
    
    table = Tables.get_table(tablename)
    changed_value = pickle.dumps(data, pickle.HIGHEST_PROTOCOL)
    if created:
        modify_flag = '1'
        old_value = ''
    else:
        old = {}
        modify_flag = '2'
        for k in data.iterkeys():
            old[k] = old_data[k]
        old_value = pickle.dumps(old, pickle.HIGHEST_PROTOCOL)
        
    obj = Audit(table_id=table, obj_id=instance.id, changed_value=changed_value,
        old_value=old_value, modified_date=datetime.now(), modified_user=request.user,
        modify_flag=modify_flag, title=unicode(instance))
        
    obj.save()
开发者ID:chyhutu,项目名称:plugs,代码行数:30,代码来源:__init__.py


示例2: remove_topic

 def remove_topic(self, forum_id, topic_id):
     from sqlalchemy.sql import select
     
     Forum = get_model('forum')
     forum = Forum.get(int(forum_id))
     Topic = get_model('forumtopic')
     topic = Topic.get(int(topic_id))
     Post = get_model('forumpost')
     post = Post.get((Post.c.topic==int(topic_id)) & (Post.c.floor==1))
     FA = get_model('forumattachment')
     
     if not topic:
         error("主题不存在")
         
     is_manager = post.topic.forum.managers.has(request.user)
     if is_manager:
         query = FA.filter(FA.c.slug==Post.c.slug).filter(Post.c.topic==int(topic_id))
         #删除相应附件
         for a in query:
             functions.delete_filename(a.file_name)
         #删除FA记录
         FA.filter(FA.c.slug.in_(select([Post.c.slug], Post.c.topic==int(topic_id)))).remove()
         #删除所有POST
         post_query = Post.filter(Post.c.topic==int(topic_id))
         post_count = post_query.count()
         post_query.remove()
         Topic.get(int(topic_id)).delete()
         Forum.filter(Forum.c.id==int(forum_id)).update(num_posts=Forum.c.num_posts-post_count, num_topics=Forum.c.num_topics-1)
         flash('删除成功!')
         return redirect(url_for(ForumView.forum_index, id=forum_id))
     else:
         flash('你无权限删除主题!')
         return redirect(url_for(ForumView.topic_view, forum_id=forum_id, topic_id=topic_id))
开发者ID:qq40660,项目名称:forum2,代码行数:33,代码来源:views.py


示例3: addbatchuser

    def addbatchuser(self):
        User = get_model('user')
        Role = get_model('role')
        
        user_ids = request.POST.get('user_ids')
        role_id = request.POST.get('role_id')
        
        user_ids = user_ids.replace('\n', ',').replace('\r', '').replace(u',',',')
        user_ids = user_ids.split(',')
        
        error_users = []
        for user_id in user_ids:
            if user_id != '':
                user = User.get(User.c.username == user_id)
                if not user:
                    error_users.append(user_id)

        if len(error_users)>0:
            return json({'success':False, 'message': u"下列人员帐号找不到: %s, 请仔细检查后再次增加。" % ','.join(error_users)})  
        else:
            role = Role.get(int(role_id))
            for user_id in user_ids:
                user = User.get(User.c.username == user_id)
                if not role.users.has(user):
                    role.users.add(user)
            message = "批量增加人员成功"
            flash(message, category='success')
            return json({'success':True, 'message': message});
开发者ID:limodou,项目名称:plugs,代码行数:28,代码来源:views.py


示例4: api_org_roles_load

    def api_org_roles_load(self, org_id):
        page = int(request.GET.get('iDisplayStart') or 0)
        psize = int(request.GET.get('iDisplayLength') or 10)
        RoleModel = get_model('role')
        UserModel = get_model('user')
        OrgRoleModel = get_model('orgrole')
        UserGroupModel = get_model('usergroup')

        totalRecords = OrgRoleModel.filter(OrgRoleModel.c.organization == org_id).count()
        query = select([RoleModel.c.id.label('role_id'), RoleModel.c.name.label('role_name'), OrgRoleModel.c.organization, OrgRoleModel.c.id.label('orgrole_id')]).select_from(join(RoleModel.table, OrgRoleModel.table, RoleModel.c.id == OrgRoleModel.c.role)).where(OrgRoleModel.c.organization == org_id).offset(page).limit(psize)
        result = do_(query)
        ret = {}
        def fetch_users(orgrole_id):
            ret = []
            userList = UserModel.filter(OrgRoleModel.users.join_filter(OrgRoleModel.c.id == orgrole_id))
            for s in userList:
                ret.append({s.id:s.username})
            return ret

        def fetch_usergroups(orgrole_id):
            ret = []
            userList = UserGroupModel.filter(OrgRoleModel.usergroups.join_filter(OrgRoleModel.c.id == orgrole_id))
            for s in userList:
                ret.append({s.id:s.name})
            return ret

        ret['aaData'] = [{'role_id':s['role_id'], 'role_name':s['role_name'], 'users':fetch_users(s.orgrole_id), 'usergroups':fetch_usergroups(s.orgrole_id), 'orgrole_id':s['orgrole_id']} for s in result]
        ret['iTotalRecords'] = totalRecords
        ret['iTotalDisplayRecords'] = totalRecords
        return json(ret)
开发者ID:zhangchunlin,项目名称:shapps,代码行数:30,代码来源:views.py


示例5: __init__

 def __init__(self):
     from uliweb.utils.generic import AddView,ListView,EditView
     self.PhoneNum = get_model('phonenumber')
     self.Tags = get_model('tags')
     self.AddView = AddView
     self.ListView = ListView
     self.EditView = EditView
开发者ID:vaneoooo,项目名称:SailYX,代码行数:7,代码来源:views.py


示例6: handle

 def handle(self, options, global_options, *args):
     from uliweb.orm import get_model
     from uliweb.utils.common import Serial
     import pprint
     
     self.get_application(global_options)
     WorkflowSpec = get_model('workflow_spec')
     TaskSpec = get_model('task_spec')
     
     print "TaskSpec : %s" % (TaskSpec.all().count())
     for task in TaskSpec.all():
         print " * %s" % task.name
         if global_options.verbose:
             print "   - modified_date: %s" % task.modified_date
             print "   - source: %s" % task.source
         if options.detail:
             pprint.pprint(Serial.load(task.content))
     
     print "\nWorkflowSpec : %s" % (WorkflowSpec.all().count())
     for wf in WorkflowSpec.all():
         print " * %s" % wf.name
         if global_options.verbose:
             print "   - modified_date: %s" % wf.modified_date
             print "   - source: %s" % wf.source
         if options.detail:
             pprint.pprint(Serial.load(wf.content))
开发者ID:panjunyong,项目名称:uliweb-redbreast,代码行数:26,代码来源:commands.py


示例7: has_role

def has_role(user, *roles, **kwargs):
    """
    Judge is the user belongs to the role, and if does, then return the role object
    if not then return False. kwargs will be passed to role_func.
    """
    Role = get_model("role")
    if isinstance(user, (unicode, str)):
        User = get_model("user")
        user = User.get(User.c.username == user)

    for role in roles:
        if isinstance(role, (str, unicode)):
            role = Role.get(Role.c.name == role)
            if not role:
                continue
        name = role.name

        func = __role_funcs__.get(name, None)
        if func:
            if isinstance(func, (unicode, str)):
                func = import_attr(func)

            assert callable(func)

            para = kwargs.copy()
            para["user"] = user
            flag = call_func(func, para)
            if flag:
                return role
        flag = role.users.has(user)
        if flag:
            return role
    return False
开发者ID:psusfy,项目名称:uliweb,代码行数:33,代码来源:rbac.py


示例8: has_org_permission

def has_org_permission(user, org, *permissions, **role_kwargs):
    """
    Judge if an user has organization permission, and if it does return role
    object, and if it doesn't return False. role_kwargs will be passed to role
    functions. With role object, you can use role.relation to get Role_Perm_Rel
    object.
    """
    Role = get_model('role')
    Perm = get_model('permission')
    Role_Perm_Rel = get_model('role_perm_rel')

    if isinstance(user, (unicode, str)):
        User = get_model('user')
        user = User.get(User.c.username==user)

    if isinstance(org, (unicode, str)):
        RbacOrg = get_model('rbacorg')
        org = RbacOrg.get(RbacOrg.c.name==org)

    for name in permissions:
        perm = Perm.get(Perm.c.name==name)
        if not perm:
            continue

        flag = has_org_role(user, org, *list(perm.perm_roles.filter(Role_Perm_Rel.c.scheme==org.rbacscheme.id).with_relation().all()), **role_kwargs)
        if flag:
            return flag

    return False
开发者ID:wangjun,项目名称:shapps,代码行数:29,代码来源:orgrbac.py


示例9: edit_post

    def edit_post(self, forum_id, topic_id, post_id):
        """
        修改回复
        """
        from uliweb.utils.generic import EditView
        
        Forum = get_model('forum')
        forum = Forum.get(int(forum_id))
        
        Topic = get_model('forumtopic')
        topic = Topic.get(int(topic_id))
        Post = get_model('forumpost')
        obj = Post.get(int(post_id))
        cur_page = request.values.get('page', 1)
        
        def pre_save(obj, data):
            data['updated_on'] = date.now()

        def post_save(obj, data):
            self._clear_files(obj.slug, data['content'])
        
        def get_form_field(name, obj):
            from uliweb.form import TextField
            if name == 'content':
                return TextField('内容', required=True, convert_html=True, rows=20)
        
        if obj.parent == None:
            anchor = post_id
        else:
            anchor = 'post_'+post_id
        url = '/forum/%s/%s?page=%s#%s' % (forum_id, topic_id, str(cur_page), anchor)
        view = EditView('forumpost', ok_url=url,
            obj=obj, pre_save=pre_save, post_save=post_save, get_form_field=get_form_field, 
            template_data={'forum':forum, 'topic':topic, 'slug':obj.slug, 'anchor':anchor})
        return view.run()
开发者ID:chyhutu,项目名称:plugs,代码行数:35,代码来源:views.py


示例10: clear

def clear():
    from uliweb.orm import get_model
    WorkflowSpec = get_model('workflow_spec')
    TaskSpec = get_model('task_spec')
    print "Deleting Workflow_Spec ..."
    WorkflowSpec.remove()
    print "Deleting Task_Spec  ..."
    TaskSpec.remove()
开发者ID:panjunyong,项目名称:uliweb-redbreast,代码行数:8,代码来源:commands.py


示例11: scan_step_all_path

def scan_step_all_path():
    from uliweb import settings

    ScanPathes = get_model("scanpathes")
    ScanPathes.remove()

    allext = {}
    root_dp = settings.SCAN.DIR
    ScanPathes(path = ".",type = "d",).save()

    count = 0
    Begin()

    IGNORE_DIRS_SET = set(settings.SCAN.DIR_IGNORE)
    for root,dirs,files in os.walk(root_dp):
        root_relp = os.path.relpath(root,root_dp)
        if not isinstance(root_relp,unicode):
            root_relp = root_relp.decode("utf8")
        sys.stdout.write(".")
        rp = ScanPathes.get(ScanPathes.c.path==root_relp)
        if not rp:
            print "\ncan not find in db so do not scan %s"%(root)
            continue
        ignore_dirs = []
        for dn in dirs:
            dp = os.path.join(root,dn)
            if os.path.islink(dp):
                print "\nignore link:%s"%(dp)
                ignore_dirs.append(dn)
            elif dn in IGNORE_DIRS_SET:
                print "\nignore dir: %s"%(dp)
                ignore_dirs.append(dn)
            else:
                relp = os.path.relpath(dp,root_dp)
                do_(ScanPathes.table.insert().values(path = relp.decode("utf8"),type = "d",parent=rp.id))
        for dn in ignore_dirs:
            dirs.remove(dn)
        l = root.split(os.sep)
        for fn in files:
            fp = os.path.join(root,fn)
            if not os.path.islink(fp):
                p,ext = os.path.splitext(fn)
                relp = os.path.relpath(fp,root_dp)
                do_(ScanPathes.table.insert().values(path = relp.decode("utf8"),type = "f",ext=ext,parent=rp.id))
                if allext.has_key(ext):
                    allext[ext] += 1
                else:
                    allext[ext] = 1
            else:
                print "\nignore link:%s"%(fp)
    Commit()

    Exts = get_model("exts")
    Exts.remove()
    for i,k in enumerate(allext):
        Exts(ext = k,num = allext[k]).save()
    print
开发者ID:zhangchunlin,项目名称:scancopyright,代码行数:57,代码来源:utils.py


示例12: detail

    def detail(self, schema_id):
        OrgModel = get_model('rbacorg')
        RoleModel = get_model('role')
        PermModel = get_model('Permission')
        RPRModel = get_model('Role_Perm_Rel')

        query = select([self.model.c.id, self.model.c.name, self.model.c.gorg, self.model.c.description, OrgModel.c.name.label('org_name')]).select_from(join(self.model.table, OrgModel.table, self.model.c.gorg == OrgModel.c.id)).where(self.model.c.id == schema_id)
        schemaList = do_(query)
        return {'schemaid':schema_id, 'schema_obj':schemaList.fetchone()}
开发者ID:zhangchunlin,项目名称:shapps,代码行数:9,代码来源:views.py


示例13: edit_topic

    def edit_topic(self, forum_id, topic_id):
        """
        修改主题
        """
        from uliweb.utils.generic import EditView

        Forum = get_model("forum")
        forum = Forum.get(int(forum_id))
        Topic = get_model("forumtopic")
        topic = Topic.get(int(topic_id))
        Post = get_model("forumpost")
        post = Post.get((Post.c.topic == int(topic_id)) & (Post.c.floor == 1))

        # compatiable not saving the first post slug bug
        if not post.slug:
            post.slug = uuid.uuid1().hex
            post.save()

        def post_save(obj, data):
            # 更新Post表
            post.content = data["content"]
            post.save()

            self._clear_files(obj.slug, data["content"])

        def pre_save(obj, data):
            flag = False
            if data["topic_type"] != obj.topic_type:
                flag = True
            if not flag and data["subject"] != obj.subject:
                flag = True
            if not flag and data["content"] != safe_str(post.content):
                flag = True
            if flag:
                data["modified_user"] = request.user.id
                data["updated_on"] = date.now()

        def get_form_field(name, obj):
            from uliweb.form import TextField

            if name == "content":
                return TextField("内容", required=True, rows=20, convert_html=True)

        data = {"content": post.content}
        view = EditView(
            "forumtopic",
            url_for(ForumView.topic_view, forum_id=forum_id, topic_id=topic_id),
            obj=topic,
            data=data,
            pre_save=pre_save,
            hidden_fields=["slug"],
            post_save=post_save,
            get_form_field=get_form_field,
            template_data={"forum": forum, "topic": topic, "slug": post.slug},
        )
        return view.run()
开发者ID:tangjn,项目名称:plugs,代码行数:56,代码来源:views.py


示例14: forum_index

    def forum_index(self, id):
        """
        显示某论坛页面
        """
        from uliweb.utils.generic import ListView

        pageno = int(request.values.get("page", 1)) - 1
        rows_per_page = int(request.values.get("rows", settings.get_var("PARA/FORUM_INDEX_NUMS")))

        Topic = get_model("forumtopic")
        Forum = get_model("forum")
        forum = Forum.get(int(id))
        condition = Topic.c.forum == int(id)
        order_by = [Topic.c.sticky.desc(), Topic.c.created_on.desc()]
        if not forum.managers.has(request.user):
            condition = (Topic.c.hidden == False) & condition

        filter = request.GET.get("filter", "all")
        if filter == "essence":
            condition = (Topic.c.essence == True) & condition

        def created_on(value, obj):
            return value.strftime("%Y-%m-%d")

        def last_reply_on(value, obj):
            return timesince(value)

        def subject(value, obj):
            if obj.topic_type:
                _type = u"[%s]" % obj.get_display_value("topic_type")
            else:
                _type = ""
            s = ""
            if obj.sticky:
                s += u'<font color="red">[顶]</font>'
            if obj.hidden:
                s += u'<font color="red">[隐]</font>'
            if obj.closed:
                s += u'<font color="red">[关]</font>'
            if obj.essence:
                s += u'<font color="red">[精]</font>'
            return _type + '<a href="/forum/%d/%d">%s</a>' % (int(id), obj.id, obj.subject) + s

        fields_convert_map = {"created_on": created_on, "subject": subject, "last_reply_on": last_reply_on}
        view = ListView(
            Topic,
            condition=condition,
            order_by=order_by,
            rows_per_page=rows_per_page,
            pageno=pageno,
            fields_convert_map=fields_convert_map,
        )
        if "data" in request.values:
            return json(view.json())
        else:
            return {"forum": forum, "filter": filter}
开发者ID:datakungfu,项目名称:plugs,代码行数:56,代码来源:views.py


示例15: ext

def ext(id):
    Exts = get_model("exts")
    ext = Exts.get(id)
    ext_str = ext.ext
    ScanPathes = get_model("scanpathes")
    pathes = ScanPathes.filter(ScanPathes.c.type=='f').filter(ScanPathes.c.ext==ext_str)
    return {
        'pathes':pathes,
        'get_path_css':get_path_css,
    }
开发者ID:gitter-badger,项目名称:scancopyright,代码行数:10,代码来源:views.py


示例16: get_tables

def get_tables(apps_dir, apps=None, engine=None, import_models=False, tables=None,
    settings_file='settings.ini', local_settings_file='local_settings.ini'):
    from uliweb.core.SimpleFrame import get_apps, get_app_dir
    from uliweb import orm
    from StringIO import StringIO
    
    engine = orm.engine_manager[engine]
    e = engine.options['connection_string']
    engine_name = e[:e.find('://')+3]
    
    buf = StringIO()
    
    if import_models:
        apps = get_apps(apps_dir, settings_file=settings_file, local_settings_file=local_settings_file)
        if apps:
            apps_list = apps
        else:
            apps_list = apps[:]
        models = []
        for p in apps_list:
            if p not in apps:
                log.error('Error: Appname %s is not a valid app' % p)
                continue
            if not is_pyfile_exist(get_app_dir(p), 'models'):
                continue
            m = '%s.models' % p
            try:
                mod = __import__(m, {}, {}, [''])
                models.append(mod)
            except ImportError:
                log.exception("There are something wrong when importing module [%s]" % m)
        
    else:
        old_models = orm.__models__.keys()
        try:
            for tablename, m in orm.__models__.items():
                orm.get_model(tablename)
        except:
            print "Problems to models like:", list(set(old_models) ^ set(orm.__models__.keys()))
            raise
            
    if apps:
        t = {}
        for tablename, m in engine.metadata.tables.items():
            if hasattr(m, '__appname__') and m.__appname__ in apps:
                t[tablename] = engine.metadata.tables[tablename]
    elif tables:
        t = {}
        for tablename, m in engine.metadata.tables.items():
            if tablename in tables:
                t[tablename] = engine.metadata.tables[tablename]
    else:
        t = engine.metadata.tables
                
    return t
开发者ID:tangjn,项目名称:uliweb,代码行数:55,代码来源:commands.py


示例17: get_tables

def get_tables(apps_dir, apps=None, engine=None, import_models=False, settings_file='settings.ini', local_settings_file='local_settings.ini'):
    from uliweb.core.SimpleFrame import get_apps, get_app_dir
    from uliweb import orm
    from sqlalchemy import create_engine
    from StringIO import StringIO
    
    if not engine:
        engine = get_engine(apps_dir)
    
    _engine = engine[:engine.find('://')+3]
    
    buf = StringIO()
    
    con = create_engine(_engine, strategy='mock', executor=lambda s, p='': buf.write(str(s) + p))
    db = orm.get_connection(con)
    
    if import_models:
        apps = get_apps(apps_dir, settings_file=settings_file, local_settings_file=local_settings_file)
        if apps:
            apps_list = apps
        else:
            apps_list = apps[:]
        models = []
        for p in apps_list:
            if p not in apps:
                log.error('Error: Appname %s is not a valid app' % p)
                continue
            if not is_pyfile_exist(get_app_dir(p), 'models'):
                continue
            m = '%s.models' % p
            try:
                mod = __import__(m, {}, {}, [''])
                models.append(mod)
            except ImportError:
                log.exception("There are something wrong when importing module [%s]" % m)
        
    else:
        old_models = orm.__models__.keys()
        try:
            for tablename, m in orm.__models__.items():
                orm.get_model(tablename)
        except:
            print "Problems to models like:", list(set(old_models) ^ set(orm.__models__.keys()))
            raise
            
    if apps:
        tables = {}
        for tablename, m in db.metadata.tables.iteritems():
            if hasattr(m, '__appname__') and m.__appname__ in apps:
                tables[tablename] = db.metadata.tables[tablename]
    else:
        tables = db.metadata.tables
                
    return tables
开发者ID:zhangming0305,项目名称:uliweb,代码行数:54,代码来源:commands.py


示例18: forum_index

 def forum_index(self, id):
     """
     显示某论坛页面
     """
     from uliweb.utils.generic import ListView
     
     pageno = int(request.values.get('page', 1)) - 1
     rows_per_page=int(request.values.get('rows', settings.get_var('PARA/FORUM_INDEX_NUMS')))
     
     Topic = get_model('forumtopic')
     Forum = get_model('forum')
     forum = Forum.get(int(id))
     condition = Topic.c.forum == int(id)
     order_by = [Topic.c.sticky.desc(), Topic.c.created_on.desc()]
     if not forum.managers.has(request.user):
         condition = (Topic.c.hidden==False) & condition
     
     filter = request.GET.get('filter', 'all')
     if filter == 'essence':
         condition = (Topic.c.essence==True) & condition
         
     def created_on(value, obj):
         return value.strftime('%Y-%m-%d')
     
     def last_reply_on(value, obj):
         return timesince(value)
     
     def subject(value, obj):
         if obj.topic_type:
             _type = u'[%s]' % obj.get_display_value('topic_type')
         else:
             _type = ''
         s = ''
         if obj.sticky:
             s += u'<font color="red">[顶]</font>'
         if obj.hidden:
             s += u'<font color="red">[隐]</font>'
         if obj.closed:
             s += u'<font color="red">[关]</font>'
         if obj.essence:
             s += u'<font color="red">[精]</font>'
         if obj.homepage:
             s += u'<font color="red">[首]</font>'
         return _type+ '<a href="/forum/%d/%d">%s</a>' % (int(id), obj.id, obj.subject) + s
     
     fields_convert_map = {'created_on':created_on, 'subject':subject,
         'last_reply_on':last_reply_on}
     view = ListView(Topic, condition=condition, order_by=order_by,
         rows_per_page=rows_per_page, pageno=pageno,
         fields_convert_map=fields_convert_map)
     if 'data' in request.values:
         return json(view.json())
     else:
         return {'forum':forum, 'filter':filter}
开发者ID:pyhunterpig,项目名称:plugs,代码行数:54,代码来源:views.py


示例19: deserialize

    def deserialize(self, obj):
        from redbreast.core.spec import CoreWFManager
        from uliweb.orm import get_model
        from uliweb.utils.common import Serial

        WFTask = get_model("workflow_task")
        WFTrans = get_model("workflow_trans")

        self.obj = obj
        if obj:
            workflow_spec = CoreWFManager.get_workflow_spec(obj.spec_name)
            self.spec = workflow_spec
            self.state = obj.state
            self.data = Serial.load(obj.data)
            self.ref_unique_id = obj.ref_unique_id

            # DEBUG -------------------------
            if __DEBUG__:
                print "workflow deserialize -----------------------------(1)"
                print "ref_unique_id: %s-%s" % (self.ref_unique_id, obj.ref_unique_id)
                print "spec_name: %s" % self.spec.name
                print "state: %s" % self.state
                print "workflow deserialize -----------------------------(2)"

            # DEBUG

            start_task_obj = None
            task_list = {}

            for task_obj in obj.tasks.order_by(WFTask.c.id):
                if not start_task_obj:
                    start_task_obj = task_obj
                task_list[task_obj.id] = self.Task(self, self.spec.get_task_spec(task_obj.alias_name), state=None)
                task_list[task_obj.id].deserialize(task_obj)

            # DEBUG -------------------------
            if __DEBUG__:
                for a in task_list:
                    print a, task_list[a]
                print "----------------------------------------------"
                print task_list[start_task_obj.id]
                print "----------------------------------------------"
            # DEBUG -------------------------

            self.task_tree = task_list[start_task_obj.id]

            for trans_obj in obj.trans.order_by(WFTrans.c.id):
                from_task_id = trans_obj._from_task_
                to_task_id = trans_obj._to_task_
                if from_task_id and to_task_id:
                    task_list[from_task_id].children.append(task_list[to_task_id])
                    task_list[to_task_id].parents.append(task_list[from_task_id])
开发者ID:uliwebext,项目名称:uliweb-redbreast,代码行数:52,代码来源:workflow.py


示例20: api_delete

    def api_delete(self):
        id = int(request.POST.get('id'))
        model = self.model.get(id)
        orgmodel = get_model('rbacorg')
        Rel = get_model('role_perm_rel')
        model.delete()
        Rel.filter(Rel.c.scheme == id).remove()
        try:
            if model.gorg is not None:
                orgmodel.filter(orgmodel.c.id == model.gorg.id).remove()
        except NotFound as e:
            mylog.error('schema related global organization not found')

        return json({'status':'OK'})
开发者ID:zhangchunlin,项目名称:shapps,代码行数:14,代码来源:views.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python settings.get函数代码示例发布时间:2022-05-27
下一篇:
Python orm.do_函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap