Changeset - 2da7b5984ae5
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-05-28 23:31:17
marcin@python-works.com
typo fix + code garden
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/db.py
Show inline comments
 
@@ -24,12 +24,13 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import os
 
import logging
 
import datetime
 
import traceback
 
import hashlib
 
from collections import defaultdict
 

	
 
from sqlalchemy import *
 
from sqlalchemy.ext.hybrid import hybrid_property
 
from sqlalchemy.orm import relationship, joinedload, class_mapper, validates
 
from beaker.cache import cache_region, region_invalidate
 
@@ -40,15 +41,14 @@ from rhodecode.lib.vcs.exceptions import
 
from rhodecode.lib.vcs.utils.lazy import LazyProperty
 

	
 
from rhodecode.lib.utils2 import str2bool, safe_str, get_changeset_safe, \
 
    safe_unicode
 
from rhodecode.lib.compat import json
 
from rhodecode.lib.caching_query import FromCache
 
from rhodecode.model.meta import Base, Session
 

	
 
from rhodecode.model.meta import Base, Session
 
import hashlib
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
#==============================================================================
 
# BASE CLASSES
 
@@ -149,12 +149,13 @@ class BaseModel(object):
 
    def __repr__(self):
 
        if hasattr(self, '__unicode__'):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class RhodeCodeSetting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine':'InnoDB',
 
         'mysql_charset': 'utf8'}
 
@@ -1125,13 +1126,13 @@ class CacheInvalidation(Base, BaseModel)
 
    def _get_or_create_key(cls, key, prefix, org_key):
 
        inv_obj = Session.query(cls).filter(cls.cache_key == key).scalar()
 
        if not inv_obj:
 
            try:
 
                inv_obj = CacheInvalidation(key, org_key)
 
                Session.add(inv_obj)
 
                #Session.commit()
 
                Session.commit()
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                Session.rollback()
 
        return inv_obj
 

	
 
    @classmethod
0 comments (0 inline, 0 general)