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


Python Container.put方法代码示例

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


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

示例1: get

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
 def get():
     key = 'CacheList'
     cache_list = Container.get(key)
     if not cache_list:
         cache_list = CacheList()
         Container.put(key, cache_list)
     return cache_list
开发者ID:mincau,项目名称:TACTIC,代码行数:9,代码来源:cache.py

示例2: install

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def install(language=""):
        # get from preferences
        if not language:
            from pyasm.biz import PrefSetting
            language = PrefSetting.get_value_by_key("language")

        # else get from project setting
        #if not language:
        #    from pyasm.prod.biz import ProdSetting
        #    language = ProdSetting.get_by_key("language")

        if os.environ.get("LC_MESSAGES"):
            language = os.environ.get("LC_MESSAGES")

        if os.environ.get("TACTIC_LANG"):
            language = os.environ.get("TACTIC_LANG")

        # else it is english
        if not language:
            language = "en"

        Container.put("language", language)

        # add some localization code
        #gettext.install("messages", unicode=True)
        #path = "%s/src/locale" % Environment.get_install_dir()
        #lang = gettext.translation("messages", localedir=path, languages=[language])
        #lang.install()

        # override the _ function
        import __builtin__
        __builtin__._ = Translation._translate
开发者ID:0-T-0,项目名称:TACTIC,代码行数:34,代码来源:translation.py

示例3: init

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def init(my):

        help = HelpItemWdg('Loader', 'The Loader lets you load 3D assets into your 3D applications. Among many options, you can choose to either reference, import, or open the asset through http or the internal file system.')
        my.add(help)

        pref = PrefSetting.get_value_by_key("use_java_maya")
        app = WebContainer.get_web().get_app_name_by_uri()
        
        if app == "Maya":
            if not Container.get('GeneralAppletWdg'):
                my.add( GeneralAppletWdg() )
                Container.put('GeneralAppletWdg', True)
        site_menu = SiteMenuWdg()
        site_menu.add_style("float", "right")
        site_menu.add_style("margin-top", "-2px")
        my.add(site_menu)
        
        WebContainer.add_js('MayaWebTools.js')
        WebContainer.add_js('PyMaya.js')
        
        tab = MayaTabWdgImpl()
        tab_value = tab.set_tab_key("maya_tab")
        #my.handle_tab(tab)
        #my.add(tab,"tab")
        my.setup_tab("maya_tab", tab=tab)
        my.add( ProgressWdg() )
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:maya_tab_wdg.py

示例4: get

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
 def get():
     # try getting from the web from
     state = Container.get("WebState")
     if not state:
         state = WebState()
         Container.put("WebState", state)
     return state
开发者ID:0-T-0,项目名称:TACTIC,代码行数:9,代码来源:web_state.py

示例5: set_pipeline

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def set_pipeline(my, pipeline_xml, cache=True):
        '''set the pipeline externally'''
        # cache according to pipeline code, which will share the same xml object
        if my.is_insert():
            cache = False

        search_key = my.get_search_key()

        xml_dict = Container.get("Pipeline:xml")
            
        if xml_dict == None:
            xml_dict = {}
            Container.put("Pipeline:xml", xml_dict)

        my.xml = xml_dict.get(search_key)
        
        if my.xml == None:
            my.xml = Xml()
            if cache:
                xml_dict[search_key] = my.xml

            if not pipeline_xml:
                pipeline_xml = "<pipeline/>"

            try:
                my.xml.read_string(pipeline_xml)
            except XmlException, e:
                my.xml.read_string("<pipeline/>")
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:pipeline.py

示例6: get_resource

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
 def get_resource(my):
     key = "Project:resource:%s" % my
     resource = Container.get(key)
     if resource == None:
         resource = ProjectResource(my)
         Container.put(key, resource)
     return resource
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:9,代码来源:project.py

示例7: get

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
 def get():
     key = "JsWrapper"
     wrapper = Container.get(key)
     if wrapper == None:
         wrapper = JsWrapper()
         Container.put(key, wrapper)
     return wrapper
开发者ID:nuxping,项目名称:TACTIC,代码行数:9,代码来源:js_wrapper.py

示例8: _test_add_drop_column

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def _test_add_drop_column(my):
        #Project.set_project('unittest')
        from pyasm.command import ColumnAddCmd, ColumnDropCmd, Command
        cmd = ColumnAddCmd('unittest/country','special_place','varchar(256)')
        Command.execute_cmd(cmd)
        search_type = 'unittest/country'

        # clear cache
        Container.put("SearchType:column_info:%s" % search_type, None)
        DatabaseImpl.clear_table_cache()
        exists = SearchType.column_exists(search_type, 'special_place')
        my.assertEquals(exists, True)

        # now drop the column
        cmd = ColumnDropCmd(search_type,'special_place')
        Command.execute_cmd(cmd)

        # clear cache
        Container.put("SearchType:column_info:%s" % search_type, None)
        cache_dict = Container.get("DatabaseImpl:column_info")

        # assume database is the same as sthpw
        database_type = Project.get_by_code("unittest").get_database_type()
        db_resource = DbResource.get_default('unittest')
        table_info = cache_dict.get("%s:%s" % (db_resource, "country"))
        #table_info = cache_dict.get('DbResource:PostgreSQL:localhost:5432:unittest:country')
        my.assertEquals(table_info != None, True)

        #key = "%s:%s" % ('DbResource:PostgreSQL:localhost:5432:unittest', 'country')
        key = "%s:%s" % (db_resource, "country")
        cache_dict[key] = None
        exists = SearchType.column_exists(search_type, 'special_place')
        my.assertEquals(exists, False)
开发者ID:blezek,项目名称:TACTIC,代码行数:35,代码来源:sql_test.py

示例9: execute

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

        search = Search("sthpw/snapshot")

        self.person = Person.create( "Unit", "Test",
                "ComputerWorld", "unittest/checkin_test")

       
        
        self._test_checkin()
        self._test_copycheckin()
        self._test_groupcheckin()
        self._test_inplace_checkin()
        self._test_preallocation_checkin()
        self._test_get_children()
        self._test_file_owner()

        self._test_symlink()
        self._test_with_naming()
        
        self._test_auto_checkin()
        self._test_strict_checkin()
   
        self._test_base_dir_alias()

        # clear the xml and config cache introduced by test_base_dir_alias
        data = {}
        Container.put(Config.CONFIG_KEY, data)

        Xml.XML_FILE_CACHE = {}
        Xml.XML_FILE_MTIME = {}
开发者ID:mincau,项目名称:TACTIC,代码行数:33,代码来源:checkin_test.py

示例10: push_palette

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
 def push_palette(cls, palette):
     palettes = Container.get("Palette:palettes")
     if palettes == None:
         palettes = []
         Container.put("Palette:palettes", palettes)
     palette = Palette(palette=palette)
     palettes.append(palette)
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:9,代码来源:palette.py

示例11: __init__

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def __init__(my, buffer_id=None, display_id=None):
        super(DynamicLoaderWdg,my).__init__()

        ref_count = Container.get("DyanmicLoaderWdg:ref_count")
        if ref_count is None:
            ref_count = 0

        if display_id is None:
            my.display_id = "dynamic_display_%s" % ref_count
        else:
            my.display_id = display_id

        if buffer_id is None:
            my.buffer_id = "dynamic_buffer_%s" % ref_count
        else:
            my.buffer_id = buffer_id

        my.loader_id = "dynamic_loader_%s" % ref_count


        Container.put("DyanmicLoaderWdg:ref_count", ref_count + 1 )


        my.load_class = None
        my.load_args = None

        web = WebContainer.get_web()
        my.loader_url = web.get_dynamic_loader_url()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:dynamic_loader_page.py

示例12: __init__

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def __init__(self, data=[]):

        if not data:
            self.data = []
        elif type(data) in types.StringTypes:
            try:
                # optimize the loading of json data
                json_data = Container.get("json_data")
                if json_data == None:
                    json_data = {}
                    Container.put("json_data", json_data)

                self.data = json_data.get(data)
                if self.data == None:
                    self.data = jsonloads(data)
                    json_data[data] = self.data

            except ValueError, e:
                if e.__str__().find('No JSON object') != -1:
                    raise SetupException('Data is not decodable as JSON.')
                # try a straight eval
                self.data = eval(data)

            except Exception as e:
                 if e.__str__().find('cannot parse JSON description') != -1:
                    raise SetupException('Data is not valid JSON.')
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:filter_data.py

示例13: get_by_key

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def get_by_key(cls, key, user=None, project_code=None, use_cache=True):
      
        if not user:
            user = Environment.get_user_name()

        # ignore the project_code column for now
        dict_key = '%s:%s:%s' %(cls.SEARCH_TYPE, project_code, user) 
        if use_cache:
            settings_dict = Container.get(dict_key)
        else:
            settings_dict = None

        # explicit check for None
        if settings_dict == None:
            settings_dict = {}

            if use_cache:
                Container.put(dict_key, settings_dict)

            search = Search(cls.SEARCH_TYPE)
            search.add_filter("login", user)
            if project_code:
                search.add_filter("project_code", project_code)
            else:
                search.add_null_filter("project_code")
            # don't filter with the key in order to build a dict
            pref_settings = search.get_sobjects()
            for setting in pref_settings:
                settings_dict[setting.get_value('key')] = setting

        pref_setting = settings_dict.get(key)

        return pref_setting
开发者ID:0-T-0,项目名称:TACTIC,代码行数:35,代码来源:preference.py

示例14: set_project

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
    def set_project(cls, project_code):
        '''This is kept here because everybody is used to using this'''

        security = Environment.get_security()
        # FIXME:
        # Because it is possible to call this before one is 
        # logged in.  This is required to see the login screen.
        from pyasm.security import get_security_version
        security_version = get_security_version()
        if security_version != 1 and not project_code == 'admin':
            key = { 'code': project_code }
            key2 = { 'code': "*" }
            keys = [key, key2]
            if not security.check_access("project", keys, access="allow", default="deny"):
                user = Environment.get_login()
                if user:
                    user = user.get_value("login")
                    raise SecurityException("User [%s] is not permitted to view project [%s]" % (user, project_code))
                else:
                    raise SecurityException("User is not permitted to view project [%s]" % (project_code))

        from pyasm.security import Site
        site = Site.get_site()
        PROJECT_KEY = "Project:global:%s:" % site
        Container.put(PROJECT_KEY, project_code)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:27,代码来源:project.py

示例15: get

# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import put [as 别名]
 def get(cls):
     filter_data = Container.get("FilterData")
     if filter_data == None:
         web = WebContainer.get_web()
         data = web.get_form_value('json')
         filter_data = FilterData(data)
         Container.put("FilterData", filter_data)
     return filter_data
开发者ID:mincau,项目名称:TACTIC,代码行数:10,代码来源:filter_data.py


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