예제 #1
0
파일: code.py 프로젝트: cclauss/infogami
def get_user_preferences():
    # @ quick hack to avoid querying for user_preferences again and again
    if 'user_preferences' not in web.ctx:
        web.ctx.user_preferences = context.get('user') and web.ctx.site.get(
            context.user.key + "/preferences"
        )
    return web.ctx.user_preferences
예제 #2
0
 def __getitem__(self, key):
     key = self.process_key(key)
     root = web.rstrips(self.getroot() or "", "/")
     if root is None or context.get('rescue_mode'):
         raise KeyError, key
     
     value = self.templates[root + key]    
     if isinstance(value, LazyTemplate):
         value = value.func()
                 
     return value
예제 #3
0
파일: code.py 프로젝트: hornc/infogami
    def __getitem__(self, key):
        key = self.process_key(key)
        root = self.getroot()
        if root is None or context.get('rescue_mode'):
            raise KeyError(key)

        root = web.rstrips(root or "", "/")
        value = self.templates[root + key]
        if isinstance(value, LazyTemplate):
            value = value.func()

        return value
예제 #4
0
파일: code.py 프로젝트: anandology/infogami
def get_user_preferences():
    #@ quick hack to avoid querying for user_preferences again and again
    if 'user_preferences' not in web.ctx:
        web.ctx.user_preferences = context.get('user') and web.ctx.site.get(context.user.key + "/preferences")
    return web.ctx.user_preferences