diff rhodecode/lib/dbmigrate/schema/db_2_0_2.py @ 4186:7e5f8c12a3fc kallithea-2.2.5-rebrand

First step in two-part process to rename directories to kallithea. This first step is to change all references in the files where they refer to the old directory name.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:04:28 -0400
parents ffd45b185016
children
line wrap: on
line diff
--- a/rhodecode/lib/dbmigrate/schema/db_2_0_2.py	Wed Jul 02 19:04:00 2014 -0400
+++ b/rhodecode/lib/dbmigrate/schema/db_2_0_2.py	Wed Jul 02 19:04:28 2014 -0400
@@ -12,7 +12,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
-rhodecode.model.db
+kallithea.model.db
 ~~~~~~~~~~~~~~~~~~
 
 Database Models for RhodeCode
@@ -41,18 +41,18 @@
 
 from pylons.i18n.translation import lazy_ugettext as _
 
-from rhodecode.lib.vcs import get_backend
-from rhodecode.lib.vcs.utils.helpers import get_scm
-from rhodecode.lib.vcs.exceptions import VCSError
-from rhodecode.lib.vcs.utils.lazy import LazyProperty
-from rhodecode.lib.vcs.backends.base import EmptyChangeset
+from kallithea.lib.vcs import get_backend
+from kallithea.lib.vcs.utils.helpers import get_scm
+from kallithea.lib.vcs.exceptions import VCSError
+from kallithea.lib.vcs.utils.lazy import LazyProperty
+from kallithea.lib.vcs.backends.base import EmptyChangeset
 
-from rhodecode.lib.utils2 import str2bool, safe_str, get_changeset_safe, \
+from kallithea.lib.utils2 import str2bool, safe_str, get_changeset_safe, \
     safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int
-from rhodecode.lib.compat import json
-from rhodecode.lib.caching_query import FromCache
+from kallithea.lib.compat import json
+from kallithea.lib.caching_query import FromCache
 
-from rhodecode.model.meta import Base, Session
+from kallithea.model.meta import Base, Session
 
 URL_SEP = '/'
 log = logging.getLogger(__name__)
@@ -303,16 +303,16 @@
     def get_server_info(cls):
         import pkg_resources
         import platform
-        import rhodecode
-        from rhodecode.lib.utils import check_git_version
+        import kallithea
+        from kallithea.lib.utils import check_git_version
         mods = [(p.project_name, p.version) for p in pkg_resources.working_set]
         info = {
             'modules': sorted(mods, key=lambda k: k[0].lower()),
             'py_version': platform.python_version(),
             'platform': safe_unicode(platform.platform()),
-            'rhodecode_version': rhodecode.__version__,
+            'rhodecode_version': kallithea.__version__,
             'git_version': safe_unicode(check_git_version()),
-            'git_path': rhodecode.CONFIG.get('git_path')
+            'git_path': kallithea.CONFIG.get('git_path')
         }
         return info
 
@@ -482,7 +482,7 @@
         """
         Returns instance of AuthUser for this user
         """
-        from rhodecode.lib.auth import AuthUser
+        from kallithea.lib.auth import AuthUser
         return AuthUser(user_id=self.user_id, api_key=self.api_key,
                         username=self.username)
 
@@ -548,7 +548,7 @@
 
         :param author:
         """
-        from rhodecode.lib.helpers import email, author_name
+        from kallithea.lib.helpers import email, author_name
         # Valid email in the attribute passed, see if they're in the system
         _email = email(author)
         if _email:
@@ -663,7 +663,7 @@
 
     @classmethod
     def _get_ip_range(cls, ip_addr):
-        from rhodecode.lib import ipaddr
+        from kallithea.lib import ipaddr
         net = ipaddr.IPNetwork(address=ip_addr)
         return [str(net.network), str(net.broadcast)]
 
@@ -921,7 +921,7 @@
 
     @hybrid_property
     def changeset_cache(self):
-        from rhodecode.lib.vcs.backends.base import EmptyChangeset
+        from kallithea.lib.vcs.backends.base import EmptyChangeset
         dummy = EmptyChangeset().__json__()
         if not self._changeset_cache:
             return dummy
@@ -1065,7 +1065,7 @@
         """
         Creates an db based ui object for this repository
         """
-        from rhodecode.lib.utils import make_ui
+        from kallithea.lib.utils import make_ui
         return make_ui('db', clear_session=False)
 
     @classmethod
@@ -1076,7 +1076,7 @@
         :param cls:
         :param repo_name:
         """
-        from rhodecode.lib.utils import is_valid_repo
+        from kallithea.lib.utils import is_valid_repo
 
         return is_valid_repo(repo_name, cls.base_path())
 
@@ -1185,7 +1185,7 @@
 
         :param cs_cache:
         """
-        from rhodecode.lib.vcs.backends.base import BaseChangeset
+        from kallithea.lib.vcs.backends.base import BaseChangeset
         if cs_cache is None:
             cs_cache = EmptyChangeset()
             # use no-cache version here
@@ -1269,7 +1269,7 @@
         return grouped
 
     def _repo_size(self):
-        from rhodecode.lib import helpers as h
+        from kallithea.lib import helpers as h
         log.debug('calculating repository size...')
         return h.format_byte_size(self.scm_instance.size)
 
@@ -1288,8 +1288,8 @@
 
     @property
     def scm_instance(self):
-        import rhodecode
-        full_cache = str2bool(rhodecode.CONFIG.get('vcs_full_cache'))
+        import kallithea
+        full_cache = str2bool(kallithea.CONFIG.get('vcs_full_cache'))
         if full_cache:
             return self.scm_instance_cached()
         return self.__get_instance()
@@ -1940,8 +1940,8 @@
         Wrapper for generating a unique cache key for this instance and "key".
         key must / will start with a repo_name which will be stored in .cache_args .
         """
-        import rhodecode
-        prefix = rhodecode.CONFIG.get('instance_id', '')
+        import kallithea
+        prefix = kallithea.CONFIG.get('instance_id', '')
         return "%s%s" % (prefix, key)
 
     @classmethod
@@ -2230,7 +2230,7 @@
 
     @property
     def description(self):
-        from rhodecode.model.notification import NotificationModel
+        from kallithea.model.notification import NotificationModel
         return NotificationModel().make_description(self)
 
 
@@ -2289,8 +2289,8 @@
         return cls.query().filter(cls.gist_access_id == gist_access_id).scalar()
 
     def gist_url(self):
-        import rhodecode
-        alias_url = rhodecode.CONFIG.get('gist_alias_url')
+        import kallithea
+        alias_url = kallithea.CONFIG.get('gist_alias_url')
         if alias_url:
             return alias_url.replace('{gistid}', self.gist_access_id)
 
@@ -2304,7 +2304,7 @@
 
         :param cls:
         """
-        from rhodecode.model.gist import GIST_STORE_LOC
+        from kallithea.model.gist import GIST_STORE_LOC
         q = Session().query(RhodeCodeUi)\
             .filter(RhodeCodeUi.ui_key == URL_SEP)
         q = q.options(FromCache("sql_cache_short", "repository_repo_path"))
@@ -2335,7 +2335,7 @@
 
     @property
     def scm_instance(self):
-        from rhodecode.lib.vcs import get_repo
+        from kallithea.lib.vcs import get_repo
         base_path = self.base_path()
         return get_repo(os.path.join(*map(safe_str,
                                           [base_path, self.gist_access_id])))