def __init__(self, app, db, session=None, **settings): self._app = app self._db = db if not session: session = web.session.Session(app, web.session.DiskStore('sessions')) self.session = session self.config = utils.storage(utils.dictadd(DEFAULT_SETTINGS, settings)) if 'captcha_func' in self.config.keys(): self.config.captcha_enabled = True hashtype = self.config.get('hash') try: if hashtype == 'sha512': self.hash = hashSha512 elif hashtype == 'sha1': self.hash = hashSha1 elif hashtype == 'bcrypt': self.hash = hashBcrypt else: raise HashError("Hash type must be 'sha512', " "'sha1' or 'bcrypt'") except ImportError: raise HashError('Hash type %s not available' % (hash,)) if self.config.auto_map: self.__mapping()
def init_app(self, app, db, session=None, **settings): self.app = app self.db = db if not session: session = web.session.Session(app, web.session.DiskStore('sessions')) self.session = session self.config = utils.storage(utils.dictadd(DEFAULT_SETTINGS, settings)) if 'captcha_func' in self.config.keys(): self.config.captcha_enabled = True hashtype = self.config.get('hash_type') try: if hashtype == 'sha512': self.hash_func = hash_sha512 elif hashtype == 'sha1': self.hash_func = hash_sha1 elif hashtype == 'bcrypt': self.hash_func = hash_bcrypt else: raise HashError("Hash type must be 'sha512', " "'sha1' or 'bcrypt'") except ImportError: raise HashError('Hash type %s not available' % (hashtype, )) if self.config.auto_map: self.__mapping() return self.app
def __init__(self, app, session, main_render): self._app = app self.db_session = None self.session = session self.config = utils.storage(utils.dictadd(DEFAULT_SETTINGS)) global render render = main_render hashtype = self.config.get('hash') if hashtype == 'sha512': self.hash = hashSha512 if self.config.auto_map: self.__mapping()
def __init__(self, app, db, session=None, **settings): self._app = app self._db = db if not session: session = web.session.Session(app, web.session.DiskStore('sessions')) self.session = session self.config = utils.storage(utils.dictadd(DEFAULT_SETTINGS, settings)) hashtype = self.config.get('hash') try: if hashtype == 'sha512': self.hash = hashSha512 elif hashtype == 'sha1': self.hash = hashSha1 elif hashtype == 'bcrypt': self.hash = hashBcrypt else: raise HashError, "Hash type must be 'sha512', 'sha1' or 'bcrypt'" except ImportError: raise HashError, 'Hash type %s not available' % (hash, ) if self.config.auto_map: self.__mapping()