##// END OF EJS Templates
feat(redis): added redis prefix support for cache backend
feat(redis): added redis prefix support for cache backend

File last commit:

r1154:1d9af4ac default
r1313:cbb3f19b default
Show More
utils.py
53 lines | 1.7 KiB | text/x-python | PythonLexer
initial commit
r0 # RhodeCode VCSServer provides access to different vcs backends via network.
source-code: updated copyrights to 2023
r1126 # Copyright (C) 2014-2023 RhodeCode GmbH
initial commit
r0 #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
sync: disable prompts to not allow in any case to block processes on input.
r381 import logging
caches: replaced beaker with dogpile cache.
r483 import hashlib
sync: disable prompts to not allow in any case to block processes on input.
r381
log = logging.getLogger(__name__)
initial commit
r0
packages: move the str utils to it's own module
r1060 class AttributeDictBase(dict):
def __getstate__(self):
odict = self.__dict__ # get attribute dictionary
return odict
git: use non-unicode author extraction as it's returned as bytes from backend, and we can...
r825
packages: move the str utils to it's own module
r1060 def __setstate__(self, dict):
self.__dict__ = dict
python3: code change for py3 support...
r1048
svn: added support for hooks management of git and subversion....
r407 __setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
caches: replaced beaker with dogpile cache.
r483
packages: move the str utils to it's own module
r1060 class StrictAttributeDict(AttributeDictBase):
"""
Strict Version of Attribute dict which raises an Attribute error when
requested attribute is not set
"""
def __getattr__(self, attr):
try:
return self[attr]
except KeyError:
strings: fix formatting
r1154 raise AttributeError(f'{self.__class__} object has no attribute {attr}')
packages: move the str utils to it's own module
r1060
class AttributeDict(AttributeDictBase):
def __getattr__(self, attr):
return self.get(attr, None)
caches: replaced beaker with dogpile cache.
r483 def sha1(val):
return hashlib.sha1(val).hexdigest()