diff rhodecode/model/db.py @ 1554:e7c6341ad3cb beta

fixes #245 Rescan of the repositories on Windows
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 13 Oct 2011 03:19:30 +0200
parents fbc762ae3496
children 1efca2908ae4
line wrap: on
line diff
--- a/rhodecode/model/db.py	Wed Oct 12 19:35:01 2011 +0200
+++ b/rhodecode/model/db.py	Thu Oct 13 03:19:30 2011 +0200
@@ -503,6 +503,10 @@
                                   self.repo_id, self.repo_name)
 
     @classmethod
+    def url_sep(cls):
+        return '/'
+    
+    @classmethod
     def get_by_repo_name(cls, repo_name):
         q = Session.query(cls).filter(cls.repo_name == repo_name)
 
@@ -523,7 +527,8 @@
         
         :param cls:
         """
-        q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/')
+        q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == 
+                                              cls.url_sep())
         q.options(FromCache("sql_cache_short", "repository_repo_path"))
         return q.one().ui_value
 
@@ -558,7 +563,8 @@
         Returns base full path for that repository means where it actually
         exists on a filesystem
         """
-        q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/')
+        q = Session.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == 
+                                              Repository.url_sep())
         q.options(FromCache("sql_cache_short", "repository_repo_path"))
         return q.one().ui_value
 
@@ -568,7 +574,7 @@
         # we need to split the name by / since this is how we store the
         # names in the database, but that eventually needs to be converted
         # into a valid system path
-        p += self.repo_name.split('/')
+        p += self.repo_name.split(Repository.url_sep())
         return os.path.join(*p)
 
     def get_new_name(self, repo_name):
@@ -578,7 +584,7 @@
         :param group_name:
         """
         path_prefix = self.group.full_path_splitted if self.group else []
-        return '/'.join(path_prefix + [repo_name])
+        return Repository.url_sep().join(path_prefix + [repo_name])
 
     @property
     def _ui(self):