示例#1
0
 def get_for_user_by_tenant(self, user_id, tenant_id):
     if tenant_id != None:
         token = MEMCACHE_SERVER.get(tenant_id + "::" + user_id)
     else:
         token = MEMCACHE_SERVER.get(user_id)
     if token != None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return token
示例#2
0
 def get_for_user_by_tenant(self, user_id, tenant_id):
     if tenant_id is not None:
         token = MEMCACHE_SERVER.get("%s::%s" % (tenant_id, user_id))
     else:
         token = MEMCACHE_SERVER.get("U%s" % user_id)
     if token is not None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return  token
示例#3
0
 def get_for_user_by_tenant(self, user_id, tenant_id):
     if tenant_id is not None:
         token = MEMCACHE_SERVER.get("%s::%s" % (tenant_id, user_id))
     else:
         token = MEMCACHE_SERVER.get("U%s" % user_id)
     if token is not None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return token
示例#4
0
文件: token.py 项目: AsherBond/colony
 def get_for_user_by_tenant(self, user_id, tenant_id):
     if tenant_id != None:
         token = MEMCACHE_SERVER.get(tenant_id + "::" + user_id)
     else:
         token = MEMCACHE_SERVER.get(user_id)
     if token != None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return  token
示例#5
0
    def create(self, token):
        if not hasattr(token, 'tenant_id'):
            token.tenant_id = None
        if token.tenant_id != None:
            tenant_user_key = token.tenant_id + "::" + token.user_id
        else:
            tenant_user_key = token.user_id

        MEMCACHE_SERVER.set(token.id, token)
        MEMCACHE_SERVER.set(tenant_user_key, token)
示例#6
0
    def create(self, token):
        if not hasattr(token, 'tenant_id'):
            token.tenant_id = None
        if token.tenant_id is not None:
            tenant_user_key = "%s::%s" % (token.tenant_id, token.user_id)
        else:
            tenant_user_key = "U%s" % token.user_id

        MEMCACHE_SERVER.set(token.id, token)
        MEMCACHE_SERVER.set(tenant_user_key, token)
示例#7
0
文件: token.py 项目: AsherBond/colony
    def create(self, token):
        if not hasattr(token, 'tenant_id'):
            token.tenant_id = None
        if token.tenant_id != None:
            tenant_user_key = token.tenant_id + "::" + token.user_id
        else:
            tenant_user_key = token.user_id

        MEMCACHE_SERVER.set(token.id, token)
        MEMCACHE_SERVER.set(tenant_user_key, token)
示例#8
0
    def create(self, token):
        if not hasattr(token, 'tenant_id'):
            token.tenant_id = None
        if token.tenant_id is not None:
            tenant_user_key = "%s::%s" % (token.tenant_id, token.user_id)
        else:
            tenant_user_key = "U%s" % token.user_id

        MEMCACHE_SERVER.set(token.id, token)
        MEMCACHE_SERVER.set(tenant_user_key, token)
示例#9
0
 def delete(self, id):
     token = self.get(id)
     if token != None:
         MEMCACHE_SERVER.delete(id)
         if token != None and not hasattr(token, 'tenant_id'):
             token.tenant_id = None
         if token.tenant_id != None:
             MEMCACHE_SERVER.delete(token.tenant_id + "::" + token.user_id)
         else:
             MEMCACHE_SERVER.delete(token.id)
             MEMCACHE_SERVER.delete(token.user_id)
示例#10
0
文件: token.py 项目: AsherBond/colony
 def delete(self, id):
     token = self.get(id)
     if token != None:
         MEMCACHE_SERVER.delete(id)
         if token != None and not hasattr(token, 'tenant_id'):
             token.tenant_id = None
         if token.tenant_id != None:
             MEMCACHE_SERVER.delete(token.tenant_id + "::" + token.user_id)
         else:
             MEMCACHE_SERVER.delete(token.id)
             MEMCACHE_SERVER.delete(token.user_id)
示例#11
0
 def delete(self, id):
     token = self.get(id)
     if token is not None:
         MEMCACHE_SERVER.delete(id)
         if token is not None and not hasattr(token, 'tenant_id'):
             token.tenant_id = None
         if token.tenant_id is not None:
             MEMCACHE_SERVER.delete("%s::%s" % (token.tenant_id,
                                                token.user_id))
         else:
             MEMCACHE_SERVER.delete(token.id)
             MEMCACHE_SERVER.delete("U%s" % token.user_id)
示例#12
0
 def delete(self, id):
     token = self.get(id)
     if token is not None:
         MEMCACHE_SERVER.delete(id)
         if token is not None and not hasattr(token, 'tenant_id'):
             token.tenant_id = None
         if token.tenant_id is not None:
             MEMCACHE_SERVER.delete("%s::%s" %
                                    (token.tenant_id, token.user_id))
         else:
             MEMCACHE_SERVER.delete(token.id)
             MEMCACHE_SERVER.delete("U%s" % token.user_id)
示例#13
0
 def get_for_user(self, user_id):
     token = MEMCACHE_SERVER.get(user_id)
     if token != None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return token
示例#14
0
 def get_for_user(self, user_id):
     token = MEMCACHE_SERVER.get("U%s" % user_id)
     if token is not None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return  token
示例#15
0
 def get(self, id):
     token = MEMCACHE_SERVER.get(id)
     if token is not None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return token
示例#16
0
 def get(self, id):
     token = MEMCACHE_SERVER.get(id)
     if token is not None and not hasattr(token, 'tenant_id'):
         token.tenant_id = None
     return token