# Path: modules/core/model/session/abstract.py
# class AbstractSession(dict):
# 
#     namespace = 'undefined'
# 
#     def __init__(self):
# 
#         if self.namespace == 'undefined':
#             raise AttributeError('namespace attribute is not defined in subclass')
# 
#         session = Registry().get('session')
# 
#         if self.namespace not in session:
#             session[self.namespace] = self
#         else:
#             self.update(session[self.namespace])
#             session[self.namespace] = self
# 
#     def set(self, key, value):
#         self[key] = value
# 
#     def getSessId(self):
#         return Registry().get('session').id
# 
#     def clear(self):
#         sess = Registry().get('session')
# 
#         import logging
#         logging.info(str(sess))
#         
#         sess.delete()
# 
# Path: models.py
# class User(db.Model):
#     name = db.StringProperty()
#     access_key = db.StringProperty()
#     email = db.StringProperty()
#     password = db.StringProperty()
#     is_admin = db.BooleanProperty()
# 
#     @property
#     def chars(self):
#         return Char.all().filter('owner = ', self.key())
# 
#     def generateAccessKey(self):
#         import random
#         random.seed()
#         hash = random.getrandbits(128)
#         self.access_key =  "%016x" % hash


from modules.core.model.session.abstract import AbstractSession
from models import User

class UserSession(AbstractSession):
    namespace = 'user'

    def isLogged(self):
        if 'user_key' in self:
            return True
        else:
            return False

    def getUser(self):
        if 'user_key' in self:

# Path: modules/core/model/session/abstract.py
# class AbstractSession(dict):
# 
#     namespace = 'undefined'
# 
#     def __init__(self):
# 
#         if self.namespace == 'undefined':
#             raise AttributeError('namespace attribute is not defined in subclass')
# 
#         session = Registry().get('session')
# 
#         if self.namespace not in session:
#             session[self.namespace] = self
#         else:
#             self.update(session[self.namespace])
#             session[self.namespace] = self
# 
#     def set(self, key, value):
#         self[key] = value
# 
#     def getSessId(self):
#         return Registry().get('session').id
# 
#     def clear(self):
#         sess = Registry().get('session')
# 
#         import logging
#         logging.info(str(sess))
#         
#         sess.delete()
# 
# Path: models.py
# class User(db.Model):
#     name = db.StringProperty()
#     access_key = db.StringProperty()
#     email = db.StringProperty()
#     password = db.StringProperty()
#     is_admin = db.BooleanProperty()
# 
#     @property
#     def chars(self):
#         return Char.all().filter('owner = ', self.key())
# 
#     def generateAccessKey(self):
#         import random
#         random.seed()
#         hash = random.getrandbits(128)
#         self.access_key =  "%016x" % hash


# Path: modules/user/model/session.py
from modules.core.model.session.abstract import AbstractSession
from models import User


class UserSession(AbstractSession):
    namespace = 'user'

    def isLogged(self):
        if 'user_key' in self:
            return True
        else:
            return False

    def getUser(self):
        if 'user_key' in self:

            user = User.get(self['user_key'])