##// END OF EJS Templates
migration: remove usage of pylons inside migration schemas and code.
marcink -
r2096:5c18693f default
parent child Browse files
Show More
@@ -17,3 +17,11 b''
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21
22 def url(*args, **kwargs):
23 """
24 Dummy url generator to be used inside the old db migration schemas that rely on it.
25 It would protect from errors after removal of pylons.
26 """
27 return '/'
@@ -34,8 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
38
37 from rhodecode.translation import _
39 38 from rhodecode.lib.vcs import get_backend
40 39 from rhodecode.lib.vcs.utils.helpers import get_scm
41 40 from rhodecode.lib.vcs.exceptions import VCSError
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -33,7 +33,7 b' from sqlalchemy.exc import DatabaseError'
33 33 from beaker.cache import cache_region, region_invalidate
34 34 from webob.exc import HTTPNotFound
35 35
36 from pylons.i18n.translation import lazy_ugettext as _
36 from rhodecode.translation import _
37 37
38 38 from rhodecode.lib.vcs import get_backend
39 39 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -33,7 +33,7 b' from sqlalchemy.exc import DatabaseError'
33 33 from beaker.cache import cache_region, region_invalidate
34 34 from webob.exc import HTTPNotFound
35 35
36 from pylons.i18n.translation import lazy_ugettext as _
36 from rhodecode.translation import _
37 37
38 38 from rhodecode.lib.vcs import get_backend
39 39 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -33,7 +33,7 b' from sqlalchemy.exc import DatabaseError'
33 33 from beaker.cache import cache_region, region_invalidate
34 34 from webob.exc import HTTPNotFound
35 35
36 from pylons.i18n.translation import lazy_ugettext as _
36 from rhodecode.translation import _
37 37
38 38 from rhodecode.lib.vcs import get_backend
39 39 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -33,7 +33,7 b' from sqlalchemy.exc import DatabaseError'
33 33 from beaker.cache import cache_region, region_invalidate
34 34 from webob.exc import HTTPNotFound
35 35
36 from pylons.i18n.translation import lazy_ugettext as _
36 from rhodecode.translation import _
37 37
38 38 from rhodecode.lib.vcs import get_backend
39 39 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -34,7 +34,7 b' from sqlalchemy.exc import DatabaseError'
34 34 from beaker.cache import cache_region, region_invalidate
35 35 from webob.exc import HTTPNotFound
36 36
37 from pylons.i18n.translation import lazy_ugettext as _
37 from rhodecode.translation import _
38 38
39 39 from rhodecode.lib.vcs import get_backend
40 40 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -37,7 +37,7 b' from sqlalchemy.exc import OperationalEr'
37 37 from beaker.cache import cache_region, region_invalidate
38 38 from webob.exc import HTTPNotFound
39 39
40 from pylons.i18n.translation import lazy_ugettext as _
40 from rhodecode.translation import _
41 41
42 42 from rhodecode.lib.vcs import get_backend
43 43 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -38,7 +38,7 b' from sqlalchemy.exc import OperationalEr'
38 38 from beaker.cache import cache_region, region_invalidate
39 39 from webob.exc import HTTPNotFound
40 40
41 from pylons.i18n.translation import lazy_ugettext as _
41 from rhodecode.translation import _
42 42
43 43 from rhodecode.lib.vcs import get_backend
44 44 from rhodecode.lib.vcs.backends.base import MergeFailureReason
@@ -42,7 +42,7 b' from Crypto.Cipher import AES'
42 42 from Crypto import Random
43 43 from zope.cachedescriptors.property import Lazy as LazyProperty
44 44
45 from pylons.i18n.translation import lazy_ugettext as _
45 from rhodecode.translation import _
46 46
47 47 from rhodecode.lib.vcs import get_backend
48 48 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -40,8 +40,7 b' from beaker.cache import cache_region, r'
40 40 from webob.exc import HTTPNotFound
41 41 from zope.cachedescriptors.property import Lazy as LazyProperty
42 42
43 from pylons import url
44 from pylons.i18n.translation import lazy_ugettext as _
43 from rhodecode.translation import _
45 44
46 45 from rhodecode.lib.vcs import get_backend
47 46 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -41,8 +41,7 b' from beaker.cache import cache_region, r'
41 41 from webob.exc import HTTPNotFound
42 42 from zope.cachedescriptors.property import Lazy as LazyProperty
43 43
44 from pylons import url
45 from pylons.i18n.translation import lazy_ugettext as _
44 from rhodecode.translation import _
46 45
47 46 from rhodecode.lib.vcs import get_backend
48 47 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -41,8 +41,7 b' from beaker.cache import cache_region, r'
41 41 from webob.exc import HTTPNotFound
42 42 from zope.cachedescriptors.property import Lazy as LazyProperty
43 43
44 from pylons import url
45 from pylons.i18n.translation import lazy_ugettext as _
44 from rhodecode.translation import _
46 45
47 46 from rhodecode.lib.vcs import get_backend
48 47 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -42,8 +42,7 b' from beaker.cache import cache_region, r'
42 42 from webob.exc import HTTPNotFound
43 43 from zope.cachedescriptors.property import Lazy as LazyProperty
44 44
45 from pylons import url
46 from pylons.i18n.translation import lazy_ugettext as _
45 from rhodecode.translation import _
47 46
48 47 from rhodecode.lib.vcs import get_backend
49 48 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -42,8 +42,7 b' from beaker.cache import cache_region, r'
42 42 from webob.exc import HTTPNotFound
43 43 from zope.cachedescriptors.property import Lazy as LazyProperty
44 44
45 from pylons import url
46 from pylons.i18n.translation import lazy_ugettext as _
45 from rhodecode.translation import _
47 46
48 47 from rhodecode.lib.vcs import get_backend
49 48 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -42,8 +42,7 b' from beaker.cache import cache_region, r'
42 42 from webob.exc import HTTPNotFound
43 43 from zope.cachedescriptors.property import Lazy as LazyProperty
44 44
45 from pylons import url
46 from pylons.i18n.translation import lazy_ugettext as _
45 from rhodecode.translation import _
47 46
48 47 from rhodecode.lib.vcs import get_backend
49 48 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -46,8 +46,9 b' from beaker.cache import cache_region, r'
46 46 from webob.exc import HTTPNotFound
47 47 from zope.cachedescriptors.property import Lazy as LazyProperty
48 48
49 from pylons import url
50 from pylons.i18n.translation import lazy_ugettext as _
49 # replace pylons with fake url for migration
50 from rhodecode.lib.dbmigrate.schema import url
51 from rhodecode.translation import _
51 52
52 53 from rhodecode.lib.vcs import get_backend
53 54 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -1775,7 +1776,7 b' class Repository(Base, BaseModel):'
1775 1776 return clone_uri
1776 1777
1777 1778 def clone_url(self, **override):
1778 qualified_home_url = url('home', qualified=True)
1779 qualified_home_url = '/'
1779 1780
1780 1781 uri_tmpl = None
1781 1782 if 'with_id' in override:
@@ -1789,13 +1790,6 b' class Repository(Base, BaseModel):'
1789 1790 # we didn't override our tmpl from **overrides
1790 1791 if not uri_tmpl:
1791 1792 uri_tmpl = self.DEFAULT_CLONE_URI
1792 try:
1793 from pylons import tmpl_context as c
1794 uri_tmpl = c.clone_uri_tmpl
1795 except Exception:
1796 # in any case if we call this outside of request context,
1797 # ie, not having tmpl_context set up
1798 pass
1799 1793
1800 1794 return get_clone_url(uri_tmpl=uri_tmpl,
1801 1795 qualifed_home_url=qualified_home_url,
@@ -46,8 +46,9 b' from beaker.cache import cache_region, r'
46 46 from webob.exc import HTTPNotFound
47 47 from zope.cachedescriptors.property import Lazy as LazyProperty
48 48
49 from pylons import url
50 from pylons.i18n.translation import lazy_ugettext as _
49 # replace pylons with fake url for migration
50 from rhodecode.lib.dbmigrate.schema import url
51 from rhodecode.translation import _
51 52
52 53 from rhodecode.lib.vcs import get_backend, get_vcs_instance
53 54 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -1778,7 +1779,7 b' class Repository(Base, BaseModel):'
1778 1779 return clone_uri
1779 1780
1780 1781 def clone_url(self, **override):
1781 qualified_home_url = url('home', qualified=True)
1782 qualified_home_url = '/'
1782 1783
1783 1784 uri_tmpl = None
1784 1785 if 'with_id' in override:
@@ -1792,13 +1793,6 b' class Repository(Base, BaseModel):'
1792 1793 # we didn't override our tmpl from **overrides
1793 1794 if not uri_tmpl:
1794 1795 uri_tmpl = self.DEFAULT_CLONE_URI
1795 try:
1796 from pylons import tmpl_context as c
1797 uri_tmpl = c.clone_uri_tmpl
1798 except Exception:
1799 # in any case if we call this outside of request context,
1800 # ie, not having tmpl_context set up
1801 pass
1802 1796
1803 1797 return get_clone_url(uri_tmpl=uri_tmpl,
1804 1798 qualifed_home_url=qualified_home_url,
@@ -46,8 +46,9 b' from beaker.cache import cache_region, r'
46 46 from webob.exc import HTTPNotFound
47 47 from zope.cachedescriptors.property import Lazy as LazyProperty
48 48
49 from pylons import url
50 from pylons.i18n.translation import lazy_ugettext as _
49 # replace pylons with fake url for migration
50 from rhodecode.lib.dbmigrate.schema import url
51 from rhodecode.translation import _
51 52
52 53 from rhodecode.lib.vcs import get_backend, get_vcs_instance
53 54 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -1778,7 +1779,7 b' class Repository(Base, BaseModel):'
1778 1779 return clone_uri
1779 1780
1780 1781 def clone_url(self, **override):
1781 qualified_home_url = url('home', qualified=True)
1782 qualified_home_url = '/'
1782 1783
1783 1784 uri_tmpl = None
1784 1785 if 'with_id' in override:
@@ -1792,13 +1793,6 b' class Repository(Base, BaseModel):'
1792 1793 # we didn't override our tmpl from **overrides
1793 1794 if not uri_tmpl:
1794 1795 uri_tmpl = self.DEFAULT_CLONE_URI
1795 try:
1796 from pylons import tmpl_context as c
1797 uri_tmpl = c.clone_uri_tmpl
1798 except Exception:
1799 # in any case if we call this outside of request context,
1800 # ie, not having tmpl_context set up
1801 pass
1802 1796
1803 1797 return get_clone_url(uri_tmpl=uri_tmpl,
1804 1798 qualifed_home_url=qualified_home_url,
@@ -47,8 +47,9 b' from beaker.cache import cache_region, r'
47 47 from webob.exc import HTTPNotFound
48 48 from zope.cachedescriptors.property import Lazy as LazyProperty
49 49
50 from pylons import url
51 from pylons.i18n.translation import lazy_ugettext as _
50 # replace pylons with fake url for migration
51 from rhodecode.lib.dbmigrate.schema import url
52 from rhodecode.translation import _
52 53
53 54 from rhodecode.lib.vcs import get_backend, get_vcs_instance
54 55 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -1780,7 +1781,7 b' class Repository(Base, BaseModel):'
1780 1781 return clone_uri
1781 1782
1782 1783 def clone_url(self, **override):
1783 qualified_home_url = url('home', qualified=True)
1784 qualified_home_url = '/'
1784 1785
1785 1786 uri_tmpl = None
1786 1787 if 'with_id' in override:
@@ -1794,13 +1795,6 b' class Repository(Base, BaseModel):'
1794 1795 # we didn't override our tmpl from **overrides
1795 1796 if not uri_tmpl:
1796 1797 uri_tmpl = self.DEFAULT_CLONE_URI
1797 try:
1798 from pylons import tmpl_context as c
1799 uri_tmpl = c.clone_uri_tmpl
1800 except Exception:
1801 # in any case if we call this outside of request context,
1802 # ie, not having tmpl_context set up
1803 pass
1804 1798
1805 1799 return get_clone_url(uri_tmpl=uri_tmpl,
1806 1800 qualifed_home_url=qualified_home_url,
@@ -47,8 +47,9 b' from beaker.cache import cache_region, r'
47 47 from webob.exc import HTTPNotFound
48 48 from zope.cachedescriptors.property import Lazy as LazyProperty
49 49
50 from pylons import url
51 from pylons.i18n.translation import lazy_ugettext as _
50 # replace pylons with fake url for migration
51 from rhodecode.lib.dbmigrate.schema import url
52 from rhodecode.translation import _
52 53
53 54 from rhodecode.lib.vcs import get_backend, get_vcs_instance
54 55 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -1780,7 +1781,7 b' class Repository(Base, BaseModel):'
1780 1781 return clone_uri
1781 1782
1782 1783 def clone_url(self, **override):
1783 qualified_home_url = url('home', qualified=True)
1784 qualified_home_url = '/'
1784 1785
1785 1786 uri_tmpl = None
1786 1787 if 'with_id' in override:
@@ -1794,13 +1795,6 b' class Repository(Base, BaseModel):'
1794 1795 # we didn't override our tmpl from **overrides
1795 1796 if not uri_tmpl:
1796 1797 uri_tmpl = self.DEFAULT_CLONE_URI
1797 try:
1798 from pylons import tmpl_context as c
1799 uri_tmpl = c.clone_uri_tmpl
1800 except Exception:
1801 # in any case if we call this outside of request context,
1802 # ie, not having tmpl_context set up
1803 pass
1804 1798
1805 1799 return get_clone_url(uri_tmpl=uri_tmpl,
1806 1800 qualifed_home_url=qualified_home_url,
@@ -45,8 +45,9 b' from beaker.cache import cache_region'
45 45 from webob.exc import HTTPNotFound
46 46 from zope.cachedescriptors.property import Lazy as LazyProperty
47 47
48 from pylons import url
49 from pylons.i18n.translation import lazy_ugettext as _
48 # replace pylons with fake url for migration
49 from rhodecode.lib.dbmigrate.schema import url
50 from rhodecode.translation import _
50 51
51 52 from rhodecode.lib.vcs import get_vcs_instance
52 53 from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
@@ -1822,7 +1823,7 b' class Repository(Base, BaseModel):'
1822 1823 return clone_uri
1823 1824
1824 1825 def clone_url(self, **override):
1825 qualified_home_url = url('home', qualified=True)
1826 qualified_home_url = '/'
1826 1827
1827 1828 uri_tmpl = None
1828 1829 if 'with_id' in override:
@@ -1836,13 +1837,6 b' class Repository(Base, BaseModel):'
1836 1837 # we didn't override our tmpl from **overrides
1837 1838 if not uri_tmpl:
1838 1839 uri_tmpl = self.DEFAULT_CLONE_URI
1839 try:
1840 from pylons import tmpl_context as c
1841 uri_tmpl = c.clone_uri_tmpl
1842 except Exception:
1843 # in any case if we call this outside of request context,
1844 # ie, not having tmpl_context set up
1845 pass
1846 1840
1847 1841 return get_clone_url(uri_tmpl=uri_tmpl,
1848 1842 qualifed_home_url=qualified_home_url,
@@ -45,8 +45,9 b' from beaker.cache import cache_region'
45 45 from webob.exc import HTTPNotFound
46 46 from zope.cachedescriptors.property import Lazy as LazyProperty
47 47
48 from pylons import url
49 from pylons.i18n.translation import lazy_ugettext as _
48 # replace pylons with fake url for migration
49 from rhodecode.lib.dbmigrate.schema import url
50 from rhodecode.translation import _
50 51
51 52 from rhodecode.lib.vcs import get_vcs_instance
52 53 from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
@@ -1823,7 +1824,7 b' class Repository(Base, BaseModel):'
1823 1824 return clone_uri
1824 1825
1825 1826 def clone_url(self, **override):
1826 qualified_home_url = url('home', qualified=True)
1827 qualified_home_url = '/'
1827 1828
1828 1829 uri_tmpl = None
1829 1830 if 'with_id' in override:
@@ -1837,13 +1838,6 b' class Repository(Base, BaseModel):'
1837 1838 # we didn't override our tmpl from **overrides
1838 1839 if not uri_tmpl:
1839 1840 uri_tmpl = self.DEFAULT_CLONE_URI
1840 try:
1841 from pylons import tmpl_context as c
1842 uri_tmpl = c.clone_uri_tmpl
1843 except Exception:
1844 # in any case if we call this outside of request context,
1845 # ie, not having tmpl_context set up
1846 pass
1847 1841
1848 1842 return get_clone_url(uri_tmpl=uri_tmpl,
1849 1843 qualifed_home_url=qualified_home_url,
@@ -38,9 +38,11 b' def downgrade(migrate_engine):'
38 38
39 39
40 40 def fixups(models, _SESSION):
41 from pylons import config
42 41 from rhodecode.lib.utils2 import str2bool
43
42 # fake config because we cannot extract the proper values from .ini here
43 config = {
44 'use_gravatar': 'true'
45 }
44 46 Optional = models.Optional
45 47
46 48 def get_by_name(cls, key):
General Comments 0
You need to be logged in to leave comments. Login now