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


Python Project.get_project_code方法代码示例

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


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

示例1: _process_task

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def _process_task(my, task, mode):
        project = Project.get_project_code()
        if not task.kwargs.get("user"):
            user = Environment.get_user_name()
        if not task.kwargs.get("project"):
            project_code = Project.get_project_code()
            task.kwargs['project'] = project_code

        task.kwargs['mode'] = mode
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:11,代码来源:scheduler.py

示例2: get_display

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def get_display(self):

        web = WebContainer.get_web()
        user = WebContainer.get_user_name()
        local_dir = web.get_local_dir()
        context_url = web.get_site_context_url().to_string()
        server = web.get_base_url().to_string()
        upload_url = web.get_upload_url()

        html = Html()
        html.writeln('<script language="JavaScript" src="resource:///res/RunHCommand.js"></script>')

        html.writeln('''\n<script>try{ app = new PyHoudini(); }
                                catch(e){
                                    app = null;}
        if (app) {
            app.user = '%(user)s';
            app.local_dir = '%(local_dir)s';
            app.context_url = '%(context_url)s';
            app.base_url = '%(server)s';
            app.upload_url = '%(upload_url)s';
            app.project_code = '%(project_code)s';} </script>'''%{'user': user,
                                           'local_dir': local_dir,
                                           'context_url' : context_url,
                                           'server': server,
                                           'upload_url':  upload_url,
                                           'project_code':  Project.get_project_code()})
        return html
开发者ID:mincau,项目名称:TACTIC,代码行数:30,代码来源:app_init_wdg.py

示例3: get_project_url

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
 def get_project_url(self):
     base_url = self.get_base_url()
     site_url = self.get_site_url().to_string()
     base_url.append_to_base(site_url)
     project_code = Project.get_project_code()
     base_url.append_to_base( project_code )
     return base_url
开发者ID:mincau,项目名称:TACTIC,代码行数:9,代码来源:web_environment.py

示例4: get

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def get(cls, texture_code, parent_code, project_code=None, is_multi=False):
        if not project_code:
            project_code = Project.get_project_code()
        search = Search( cls.SEARCH_TYPE, project_code )
        
        #search.set_show_retired(True)
        
        if texture_code:
            search.add_filter('code', texture_code)
        
        # backward compatible with using shot code
        if isinstance(parent_code, basestring):
            from pyasm.prod.biz import Shot
            parent = Shot.get_by_code(parent_code)
        else:
            parent = parent_code
        if not parent:
            if is_multi:
                return []
            else:
                return None

        search.add_filter('search_type',  parent.get_search_type())
        search.add_filter('search_id',  parent.get_id())
        parent_key = SearchKey.get_by_sobject(parent)
        
        search_type = search.get_search_type()
        key = "%s|%s|%s" % (search_type, texture_code, parent_key)
        sobj = cls.get_by_search(search, key, is_multi=is_multi)
       
        return sobj
开发者ID:mincau,项目名称:TACTIC,代码行数:33,代码来源:texture.py

示例5: execute

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def execute(my):

        my.base_dir = my.kwargs.get("base_dir")
        if not my.base_dir:
            my.base_dir = Environment.get_template_dir()


        my.project_code = my.kwargs.get("project_code")
        if not my.project_code:
            my.project_code = Project.get_project_code()

        assert my.project_code

        # project code can be called anything, and we want to have a _template suffix for the template code
        #my.plugin_code = "%s_template" % my.project_code

        #my.template_project_code = re.sub( '_template$', '', my.plugin_code)
        my.template_project_code = my.project_code
        my.project = Project.get_by_code(my.project_code)
        if not my.project:
            raise TacticException('This project [%s] does not exist'%my.project_code)

        my.project_type = my.project.get_value("type")
        if not my.project_type:
            my.project_type = my.project_code
        Project.set_project(my.project_code)

        my.export_template()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:project_template_cmd.py

示例6: get_display

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def get_display(my):

        web = WebContainer.get_web()
        user = WebContainer.get_user_name()
        local_dir = web.get_local_dir()
        context_url = web.get_site_context_url().to_string()
        server = web.get_base_url().to_string()
        upload_url = web.get_upload_url()

        html = Html()

        html.writeln('''\n<script>try{ app = new PyXSI(); }
                                catch(e){
                                    app = null;}
        if (app) {
            app.user = '%(user)s';
            app.local_dir = '%(local_dir)s';
            app.context_url = '%(context_url)s';
            app.base_url = '%(server)s';
            app.upload_url = '%(upload_url)s';
            app.project_code = '%(project_code)s';} </script>'''%{'user': user,
                                           'local_dir': local_dir,
                                           'context_url' : context_url,
                                           'server': server,
                                           'upload_url':  upload_url,
                                           'project_code':  Project.get_project_code()})
                            


        return html
开发者ID:0-T-0,项目名称:TACTIC,代码行数:32,代码来源:app_init_wdg.py

示例7: get_security_wdg

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def get_security_wdg(self):

        div = DivWdg()
        div.add_class("spt_security")

        div.add("A server can sync either be scoped for a single project or all projects.  Transactions that occur in the admin project never get synced.")

        div.add("<br/>"*2)

        div.add("Project: ")

        search = Search("sthpw/project")
        search.add_filters("code", ['admin','unittest'], op='not in')
        search.add_order_by("title")
        projects = search.get_sobjects()

        select = SelectWdg("projects")
        div.add(select)
        labels = [x.get_value("title") for x in projects]
        values = [x.get_value("code") for x in projects]

        project_code = Project.get_project_code()
        if project_code != 'admin':
            select.set_value(project_code)
        select.set_option("labels", labels)
        select.set_option("values", values)
        select.add_empty_option("-- All --")


        div.add("<br/>"*2)

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:34,代码来源:sync_settings_wdg.py

示例8: clear_db_cache

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def clear_db_cache(cls):
        Container.put(cls.KEY, None)

        from pyasm.biz import Project
        project_code = Project.get_project_code()
        key = "%s:%s" % (cls.KEY, project_code)
        Container.put(key, None)
开发者ID:nuxping,项目名称:TACTIC,代码行数:9,代码来源:trigger.py

示例9: get_by_key

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def get_by_key(key, auto_create=True):
        login = WebContainer.get_user_name()
        dict_key = '%s:%s' %(WidgetSettings.SEARCH_TYPE, login) 
        settings_dict = Container.get(dict_key)
        setting = None
        if not settings_dict:
            
            settings_dict = {}
            Container.put(dict_key, settings_dict)
                   
            search = Search(WidgetSettings.SEARCH_TYPE)
            search.add_filter("project_code", Project.get_project_code())
            search.add_filter("login", login)
            settings = search.get_sobjects()
            for setting in settings:
                settings_dict[setting.get_value('key')] = setting
                
        setting = settings_dict.get(key)
            
        # autocreate if it does not exist
        if auto_create and setting == None:
            setting = WidgetSettings.create(key)
            
            settings_dict[setting.get_value('key')] = setting

        return setting
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:widget.py

示例10: add

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def add(command, kwargs, queue_type, priority, description, message_code=None):

        queue = SearchType.create("sthpw/queue")
        queue.set_value("project_code", Project.get_project_code())
        #queue.set_sobject_value(sobject)

        if not queue_type:
            queue_type = "default"
        queue.set_value("queue", queue_type)

        queue.set_value("state", "pending")

        queue.set_value("login", Environment.get_user_name())

        queue.set_value("command", command)
        data = jsondumps(kwargs)
        queue.set_value("data", data)

        if message_code:
            queue.set_value("message_code", message_code)


        if not priority:
            priority = 9999
        queue.set_value("priority", priority)

        if description:
            queue.set_value("description", description)

        queue.set_user()
        queue.commit()

        return queue
开发者ID:mincau,项目名称:TACTIC,代码行数:35,代码来源:queue.py

示例11: _get_result

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def _get_result(my, sobject):

        # get the parent or relation
        column = my.get_column()
        parent_id = sobject.get_value(column)
        parent = my.parents_dict.get(parent_id)
        if not parent:
            return super(ForeignKeyElementWdg,my).get_display()


        template = my.get_option('template')
        # if not set, then look at the schema
        if not template:
            schema = Schema.get_by_project_code( Project.get_project_code() )
            search_type = parent.get_base_search_type()
            template = schema.get_attr_by_search_type(search_type,'display_template')

        if template:
            value = NamingUtil.eval_template(template, sobject, parent=parent)
        else:
            # NOTE: put something ... anything as a default
            columns = parent.get_search_type_obj().get_columns()
            if not len(columns):
                value = parent.get_value(columns[0])
            else:
                value = parent.get_value(columns[1])

        return value
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:foreign_key_element_wdg.py

示例12: get_to

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def get_to(my):
        recipients = super(GeneralPublishEmailHandler, my).get_to()
        sobj = my.sobject

        search = Search(Task)
        
        search_type = sobj.get_search_type()
        
        search_id = sobj.get_id()
       
        search.add_filter('search_type', search_type)
        search.add_filter('search_id', search_id )
        # it will get the context if process not found
        #search.add_filter('process', note.get_process())
        from pyasm.biz import Project
        search.add_filter('project_code', Project.get_project_code())
        tasks = search.get_sobjects()
        for task in tasks:
            assigned = my._get_login(task.get_assigned())
            if assigned:
                recipients.add(assigned)
            supe = my._get_login(task.get_supervisor())
            if supe:
                recipients.add(supe)
        return recipients
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:27,代码来源:email_handler.py

示例13: get_db_triggers

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def get_db_triggers(cls):

        site_triggers = Container.get(cls.KEY)
        if site_triggers == None:
            # find all of the triggers
            search = Search("sthpw/trigger")
            search.add_project_filter()
            site_triggers = search.get_sobjects()
            Container.put(cls.KEY, site_triggers)

        # find all of the project triggers
        from pyasm.biz import Project
        project_code = Project.get_project_code()
        key = "%s:%s" % (cls.KEY, project_code)
        project_triggers = Container.get(key)
        if project_triggers == None:
            if project_code not in ['admin','sthpw']:
                try:
                    search = Search("config/trigger")
                    project_triggers = search.get_sobjects()
                except SearchException, e:
                    print "WARNING: ", e
                    project_triggers = []
            else:
                project_triggers = []
            Container.put(key, project_triggers)
开发者ID:blezek,项目名称:TACTIC,代码行数:28,代码来源:trigger.py

示例14: copy_sobject

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def copy_sobject(my, sobject, dst_search_type, context=None, checkin_mode='inplace'):

        new_sobject = SearchType.create(dst_search_type)
        search_type = SearchType.get(dst_search_type)
        columns = SearchType.get_columns(dst_search_type)

        data = sobject.get_data()
        for name, value in data.items():
            if name in ['id','pipeline_code']:
                continue

            if name not in columns:
                continue

            if not value:
                continue

            if name == "code":
                value = Common.get_next_sobject_code(sobject, 'code')
                if not value:
                    continue
            new_sobject.set_value(name, value)
        if SearchType.column_exists(dst_search_type, "project_code"):
            project_code = Project.get_project_code()
            new_sobject.set_value("project_code", project_code)
        new_sobject.commit()



        # get all of the current snapshots and file paths associated
        if not context:
            snapshots = Snapshot.get_all_current_by_sobject(sobject)
        else:
            snapshots = [Snapshot.get_current_by_sobject(sobject, context)]

        if not snapshots:
            return

        msgs = []
        for snapshot in snapshots:
            #file_paths = snapshot.get_all_lib_paths()
            file_paths_dict = snapshot.get_all_paths_dict()
            file_types = file_paths_dict.keys()
            if not file_types:
                continue

            # make sure the paths match the file_types
            file_paths = [file_paths_dict.get(x)[0] for x in file_types]

            mode = checkin_mode

            # checkin the files (inplace)
            try:
                context = snapshot.get_value('context')
                checkin = FileCheckin(new_sobject, context=context, file_paths=file_paths, file_types=file_types, mode=mode)
                checkin.execute()

                #print "done: ", context, new_sobject.get_related_sobjects("sthpw/snapshot")
            except CheckinException, e:
                msgs.append('Post-process Check-in Error for %s: %s ' %(context, e.__str__()))
开发者ID:0-T-0,项目名称:TACTIC,代码行数:62,代码来源:sobject_copy_cmd.py

示例15: execute

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_project_code [as 别名]
    def execute(self):

        self.base_dir = self.kwargs.get("base_dir")
        if not self.base_dir:
            self.base_dir = Environment.get_template_dir()


        self.project_code = self.kwargs.get("project_code")
        if not self.project_code:
            self.project_code = Project.get_project_code()

        assert self.project_code

        # project code can be called anything, and we want to have a _template suffix for the template code
        #self.plugin_code = "%s_template" % self.project_code

        #self.template_project_code = re.sub( '_template$', '', self.plugin_code)
        self.template_project_code = self.project_code
        self.project = Project.get_by_code(self.project_code)
        if not self.project:
            raise TacticException('This project [%s] does not exist'%self.project_code)

        self.project_type = self.project.get_value("type")
        if not self.project_type:
            self.project_type = self.project_code
        Project.set_project(self.project_code)

        self.export_template()
开发者ID:mincau,项目名称:TACTIC,代码行数:30,代码来源:project_template_cmd.py


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