##// END OF EJS Templates
pylons: remove pylons as dependency...
marcink -
r2351:59272121 default
parent child
Show More
@@ -61,23 +61,6 self: super: {
61 61 ];
62 62 });
63 63
64 celery = super.celery.override (attrs: {
65 # The current version of kombu needs some patching to work with the
66 # other libs. Should be removed once we update celery and kombu.
67 patches = [
68 ./patch-celery-dateutil.diff
69 ];
70 });
71
72 kombu = super.kombu.override (attrs: {
73 # The current version of kombu needs some patching to work with the
74 # other libs. Should be removed once we update celery and kombu.
75 patches = [
76 ./patch-kombu-py-2-7-11.diff
77 ./patch-kombu-msgpack.diff
78 ];
79 });
80
81 64 lxml = super.lxml.override (attrs: {
82 65 # johbo: On 16.09 we need this to compile on darwin, otherwise compilation
83 66 # fails on Darwin.
@@ -133,10 +116,6 self: super: {
133 116 };
134 117 });
135 118
136 Pylons = super.Pylons.override (attrs: {
137 name = "Pylons-1.0.2.rhodecode-patch1";
138 });
139
140 119 pyramid = super.pyramid.override (attrs: {
141 120 postFixup = ''
142 121 wrapPythonPrograms
@@ -184,30 +184,17
184 184 license = [ pkgs.lib.licenses.bsdOriginal ];
185 185 };
186 186 };
187 Pylons = super.buildPythonPackage {
188 name = "Pylons-1.0.2.dev20171106";
187 Routes = super.buildPythonPackage {
188 name = "Routes-2.4.1";
189 189 buildInputs = with self; [];
190 190 doCheck = false;
191 propagatedBuildInputs = with self; [Routes WebHelpers Beaker Paste PasteDeploy PasteScript FormEncode simplejson decorator nose Mako WebError WebTest Tempita MarkupSafe WebOb];
191 propagatedBuildInputs = with self; [six repoze.lru];
192 192 src = fetchurl {
193 url = "https://code.rhodecode.com/upstream/pylons/archive/707354ee4261b9c10450404fc9852ccea4fd667d.tar.gz?md5=f26633726fa2cd3a340316ee6a5d218f";
194 md5 = "f26633726fa2cd3a340316ee6a5d218f";
193 url = "https://pypi.python.org/packages/33/38/ea827837e68d9c7dde4cff7ec122a93c319f0effc08ce92a17095576603f/Routes-2.4.1.tar.gz";
194 md5 = "c058dff6832941dec47e0d0052548ad8";
195 195 };
196 196 meta = {
197 license = [ pkgs.lib.licenses.bsdOriginal ];
198 };
199 };
200 Routes = super.buildPythonPackage {
201 name = "Routes-1.13";
202 buildInputs = with self; [];
203 doCheck = false;
204 propagatedBuildInputs = with self; [repoze.lru];
205 src = fetchurl {
206 url = "https://pypi.python.org/packages/88/d3/259c3b3cde8837eb9441ab5f574a660e8a4acea8f54a078441d4d2acac1c/Routes-1.13.tar.gz";
207 md5 = "d527b0ab7dd9172b1275a41f97448783";
208 };
209 meta = {
210 license = [ pkgs.lib.licenses.bsdOriginal ];
197 license = [ pkgs.lib.licenses.mit ];
211 198 };
212 199 };
213 200 SQLAlchemy = super.buildPythonPackage {
@@ -340,6 +327,19
340 327 license = [ pkgs.lib.licenses.mit ];
341 328 };
342 329 };
330 amqp = super.buildPythonPackage {
331 name = "amqp-2.2.2";
332 buildInputs = with self; [];
333 doCheck = false;
334 propagatedBuildInputs = with self; [vine];
335 src = fetchurl {
336 url = "https://pypi.python.org/packages/e0/70/9ab9ccd8247fb7d2adb717e9f6a0ed358c9e1ab2c349048b0352f9e80ee2/amqp-2.2.2.tar.gz";
337 md5 = "0971a3fd2d635ded45c349cfc17106bd";
338 };
339 meta = {
340 license = [ pkgs.lib.licenses.bsdOriginal ];
341 };
342 };
343 343 amqplib = super.buildPythonPackage {
344 344 name = "amqplib-1.0.2";
345 345 buildInputs = with self; [];
@@ -353,19 +353,6
353 353 license = [ { fullName = "LGPL"; } { fullName = "GNU Library or Lesser General Public License (LGPL)"; } ];
354 354 };
355 355 };
356 anyjson = super.buildPythonPackage {
357 name = "anyjson-0.3.3";
358 buildInputs = with self; [];
359 doCheck = false;
360 propagatedBuildInputs = with self; [];
361 src = fetchurl {
362 url = "https://pypi.python.org/packages/c3/4d/d4089e1a3dd25b46bebdb55a992b0797cff657b4477bc32ce28038fdecbc/anyjson-0.3.3.tar.gz";
363 md5 = "2ea28d6ec311aeeebaf993cb3008b27c";
364 };
365 meta = {
366 license = [ pkgs.lib.licenses.bsdOriginal ];
367 };
368 };
369 356 appenlight-client = super.buildPythonPackage {
370 357 name = "appenlight-client-0.6.22";
371 358 buildInputs = with self; [];
@@ -418,6 +405,19
418 405 license = [ pkgs.lib.licenses.mit ];
419 406 };
420 407 };
408 billiard = super.buildPythonPackage {
409 name = "billiard-3.5.0.3";
410 buildInputs = with self; [];
411 doCheck = false;
412 propagatedBuildInputs = with self; [];
413 src = fetchurl {
414 url = "https://pypi.python.org/packages/39/ac/f5571210cca2e4f4532e38aaff242f26c8654c5e2436bee966c230647ccc/billiard-3.5.0.3.tar.gz";
415 md5 = "113ba481e48400adbf6fbbf59a2f8554";
416 };
417 meta = {
418 license = [ pkgs.lib.licenses.bsdOriginal ];
419 };
420 };
421 421 bleach = super.buildPythonPackage {
422 422 name = "bleach-1.5.0";
423 423 buildInputs = with self; [];
@@ -458,13 +458,13
458 458 };
459 459 };
460 460 celery = super.buildPythonPackage {
461 name = "celery-2.2.10";
461 name = "celery-4.1.0";
462 462 buildInputs = with self; [];
463 463 doCheck = false;
464 propagatedBuildInputs = with self; [python-dateutil anyjson kombu pyparsing];
464 propagatedBuildInputs = with self; [pytz billiard kombu];
465 465 src = fetchurl {
466 url = "https://pypi.python.org/packages/b1/64/860fd50e45844c83442e7953effcddeff66b2851d90b2d784f7201c111b8/celery-2.2.10.tar.gz";
467 md5 = "898bc87e54f278055b561316ba73e222";
466 url = "https://pypi.python.org/packages/07/65/88a2a45fc80f487872c93121a701a53bbbc3d3d832016876fac84fc8d46a/celery-4.1.0.tar.gz";
467 md5 = "db91e1d26936381127f01e150fe3054a";
468 468 };
469 469 meta = {
470 470 license = [ pkgs.lib.licenses.bsdOriginal ];
@@ -1004,13 +1004,13
1004 1004 };
1005 1005 };
1006 1006 kombu = super.buildPythonPackage {
1007 name = "kombu-1.5.1";
1007 name = "kombu-4.1.0";
1008 1008 buildInputs = with self; [];
1009 1009 doCheck = false;
1010 propagatedBuildInputs = with self; [anyjson amqplib];
1010 propagatedBuildInputs = with self; [amqp];
1011 1011 src = fetchurl {
1012 url = "https://pypi.python.org/packages/19/53/74bf2a624644b45f0850a638752514fc10a8e1cbd738f10804951a6df3f5/kombu-1.5.1.tar.gz";
1013 md5 = "50662f3c7e9395b3d0721fb75d100b63";
1012 url = "https://pypi.python.org/packages/03/5e/1a47d1e543d4943d65330af4e4406049f443878818fb65bfdc651bb93a96/kombu-4.1.0.tar.gz";
1013 md5 = "2fb2be9fec0e6514231bba23a3779439";
1014 1014 };
1015 1015 meta = {
1016 1016 license = [ pkgs.lib.licenses.bsdOriginal ];
@@ -1094,19 +1094,6
1094 1094 license = [ pkgs.lib.licenses.bsdOriginal ];
1095 1095 };
1096 1096 };
1097 nose = super.buildPythonPackage {
1098 name = "nose-1.3.6";
1099 buildInputs = with self; [];
1100 doCheck = false;
1101 propagatedBuildInputs = with self; [];
1102 src = fetchurl {
1103 url = "https://pypi.python.org/packages/70/c7/469e68148d17a0d3db5ed49150242fd70a74a8147b8f3f8b87776e028d99/nose-1.3.6.tar.gz";
1104 md5 = "0ca546d81ca8309080fc80cb389e7a16";
1105 };
1106 meta = {
1107 license = [ { fullName = "GNU Library or Lesser General Public License (LGPL)"; } { fullName = "GNU LGPL"; } ];
1108 };
1109 };
1110 1097 objgraph = super.buildPythonPackage {
1111 1098 name = "objgraph-3.1.1";
1112 1099 buildInputs = with self; [];
@@ -1173,13 +1160,13
1173 1160 };
1174 1161 };
1175 1162 pexpect = super.buildPythonPackage {
1176 name = "pexpect-4.2.1";
1163 name = "pexpect-4.3.0";
1177 1164 buildInputs = with self; [];
1178 1165 doCheck = false;
1179 1166 propagatedBuildInputs = with self; [ptyprocess];
1180 1167 src = fetchurl {
1181 url = "https://pypi.python.org/packages/e8/13/d0b0599099d6cd23663043a2a0bb7c61e58c6ba359b2656e6fb000ef5b98/pexpect-4.2.1.tar.gz";
1182 md5 = "3694410001a99dff83f0b500a1ca1c95";
1168 url = "https://pypi.python.org/packages/f8/44/5466c30e49762bb92e442bbdf4472d6904608d211258eb3198a11f0309a4/pexpect-4.3.0.tar.gz";
1169 md5 = "047a486dcd26134b74f2e67046bb61a0";
1183 1170 };
1184 1171 meta = {
1185 1172 license = [ pkgs.lib.licenses.isc { fullName = "ISC License (ISCL)"; } ];
@@ -1550,16 +1537,16
1550 1537 };
1551 1538 };
1552 1539 python-dateutil = super.buildPythonPackage {
1553 name = "python-dateutil-2.1";
1540 name = "python-dateutil-2.6.1";
1554 1541 buildInputs = with self; [];
1555 1542 doCheck = false;
1556 1543 propagatedBuildInputs = with self; [six];
1557 1544 src = fetchurl {
1558 url = "https://pypi.python.org/packages/65/52/9c18dac21f174ad31b65e22d24297864a954e6fe65876eba3f5773d2da43/python-dateutil-2.1.tar.gz";
1559 md5 = "1534bb15cf311f07afaa3aacba1c028b";
1545 url = "https://pypi.python.org/packages/54/bb/f1db86504f7a49e1d9b9301531181b00a1c7325dc85a29160ee3eaa73a54/python-dateutil-2.6.1.tar.gz";
1546 md5 = "db38f6b4511cefd76014745bb0cc45a4";
1560 1547 };
1561 1548 meta = {
1562 license = [ { fullName = "Simplified BSD"; } ];
1549 license = [ pkgs.lib.licenses.bsdOriginal { fullName = "Simplified BSD"; } ];
1563 1550 };
1564 1551 };
1565 1552 python-editor = super.buildPythonPackage {
@@ -1615,13 +1602,13
1615 1602 };
1616 1603 };
1617 1604 pytz = super.buildPythonPackage {
1618 name = "pytz-2015.4";
1605 name = "pytz-2017.3";
1619 1606 buildInputs = with self; [];
1620 1607 doCheck = false;
1621 1608 propagatedBuildInputs = with self; [];
1622 1609 src = fetchurl {
1623 url = "https://pypi.python.org/packages/7e/1a/f43b5c92df7b156822030fed151327ea096bcf417e45acc23bd1df43472f/pytz-2015.4.zip";
1624 md5 = "233f2a2b370d03f9b5911700cc9ebf3c";
1610 url = "https://pypi.python.org/packages/60/88/d3152c234da4b2a1f7a989f89609ea488225eaea015bc16fbde2b3fdfefa/pytz-2017.3.zip";
1611 md5 = "7006b56c0d68a162d9fe57d4249c3171";
1625 1612 };
1626 1613 meta = {
1627 1614 license = [ pkgs.lib.licenses.mit ];
@@ -1696,7 +1683,7
1696 1683 name = "rhodecode-enterprise-ce-4.11.0";
1697 1684 buildInputs = with self; [pytest py pytest-cov pytest-sugar pytest-runner pytest-catchlog pytest-profiling gprof2dot pytest-timeout mock WebTest cov-core coverage configobj];
1698 1685 doCheck = true;
1699 propagatedBuildInputs = with self; [Babel Beaker FormEncode Mako Markdown MarkupSafe MySQL-python Paste PasteDeploy PasteScript Pygments pygments-markdown-lexer Pylons Routes SQLAlchemy Tempita URLObject WebError WebHelpers WebHelpers2 WebOb WebTest Whoosh alembic amqplib anyjson appenlight-client authomatic cssselect celery channelstream colander decorator deform docutils gevent gunicorn infrae.cache ipython iso8601 kombu lxml msgpack-python nbconvert packaging psycopg2 py-gfm pycrypto pycurl pyparsing pyramid pyramid-debugtoolbar pyramid-mako pyramid-beaker pysqlite python-dateutil python-ldap python-memcached python-pam recaptcha-client redis repoze.lru requests simplejson sshpubkeys subprocess32 waitress zope.cachedescriptors dogpile.cache dogpile.core psutil py-bcrypt];
1686 propagatedBuildInputs = with self; [setuptools-scm amqplib amqp authomatic Babel Beaker celery Chameleon channelstream click colander configobj cssselect decorator deform docutils dogpile.cache dogpile.core ecdsa FormEncode future futures gnureadline infrae.cache iso8601 itsdangerous Jinja2 billiard kombu lxml Mako Markdown MarkupSafe msgpack-python MySQL-python objgraph packaging Paste PasteDeploy PasteScript pathlib2 peppercorn psutil psycopg2 py-bcrypt pycrypto pycurl pyflakes pygments-markdown-lexer Pygments pyparsing pyramid-beaker pyramid-debugtoolbar pyramid-jinja2 pyramid-mako pyramid pysqlite python-dateutil python-ldap python-memcached python-pam pytz pyzmq py-gfm recaptcha-client redis repoze.lru requests Routes setproctitle simplejson six SQLAlchemy sshpubkeys subprocess32 Tempita translationstring trollius urllib3 URLObject venusian WebError WebHelpers2 WebHelpers WebOb Whoosh wsgiref zope.cachedescriptors zope.deprecation zope.event zope.interface nbconvert bleach nbformat jupyter-client alembic invoke bumpversion transifex-client gevent greenlet gunicorn waitress uWSGI ipdb ipython CProfileV bottle rhodecode-tools appenlight-client pytest py pytest-cov pytest-sugar pytest-runner pytest-catchlog pytest-profiling gprof2dot pytest-timeout mock WebTest cov-core coverage];
1700 1687 src = ./.;
1701 1688 meta = {
1702 1689 license = [ { fullName = "Affero GNU General Public License v3 or later (AGPLv3+)"; } { fullName = "AGPLv3, and Commercial License"; } ];
@@ -1755,13 +1742,13
1755 1742 };
1756 1743 };
1757 1744 setuptools-scm = super.buildPythonPackage {
1758 name = "setuptools-scm-1.15.0";
1745 name = "setuptools-scm-1.15.6";
1759 1746 buildInputs = with self; [];
1760 1747 doCheck = false;
1761 1748 propagatedBuildInputs = with self; [];
1762 1749 src = fetchurl {
1763 url = "https://pypi.python.org/packages/80/b7/31b6ae5fcb188e37f7e31abe75f9be90490a5456a72860fa6e643f8a3cbc/setuptools_scm-1.15.0.tar.gz";
1764 md5 = "b6916c78ed6253d6602444fad4279c5b";
1750 url = "https://pypi.python.org/packages/03/6d/aafdd01edd227ee879b691455bf19895091872af7e48192bea1758c82032/setuptools_scm-1.15.6.tar.gz";
1751 md5 = "f17493d53f0d842bb0152f214775640b";
1765 1752 };
1766 1753 meta = {
1767 1754 license = [ pkgs.lib.licenses.mit ];
@@ -1949,6 +1936,19
1949 1936 license = [ { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ];
1950 1937 };
1951 1938 };
1939 vine = super.buildPythonPackage {
1940 name = "vine-1.1.4";
1941 buildInputs = with self; [];
1942 doCheck = false;
1943 propagatedBuildInputs = with self; [];
1944 src = fetchurl {
1945 url = "https://pypi.python.org/packages/32/23/36284986e011f3c130d802c3c66abd8f1aef371eae110ddf80c5ae22e1ff/vine-1.1.4.tar.gz";
1946 md5 = "9fdb971e7fd15b181b84f3bfcf20d11c";
1947 };
1948 meta = {
1949 license = [ pkgs.lib.licenses.bsdOriginal ];
1950 };
1951 };
1952 1952 waitress = super.buildPythonPackage {
1953 1953 name = "waitress-1.1.0";
1954 1954 buildInputs = with self; [];
@@ -1,13 +1,13
1 1 ## core
2 2 setuptools==30.1.0
3 setuptools-scm==1.15.0
3 setuptools-scm==1.15.6
4 4
5 5 amqplib==1.0.2
6 anyjson==0.3.3
6 amqp==2.2.2
7 7 authomatic==0.1.0.post1
8 8 Babel==1.3
9 9 Beaker==1.9.0
10 celery==2.2.10
10 celery==4.1.0
11 11 Chameleon==2.24
12 12 channelstream==0.5.2
13 13 click==6.6
@@ -28,7 +28,8 infrae.cache==1.0.1
28 28 iso8601==0.1.12
29 29 itsdangerous==0.24
30 30 Jinja2==2.9.6
31 kombu==1.5.1
31 billiard==3.5.0.3
32 kombu==4.1.0
32 33 lxml==3.7.3
33 34 Mako==1.0.7
34 35 Markdown==2.6.9
@@ -57,18 +58,18 pyramid-jinja2==2.7
57 58 pyramid-mako==1.0.2
58 59 pyramid==1.9.1
59 60 pysqlite==2.8.3
60 python-dateutil==2.1
61 python-dateutil
61 62 python-ldap==2.4.45
62 63 python-memcached==1.58
63 64 python-pam==1.8.2
64 pytz==2015.4
65 pytz==2017.3
65 66 pyzmq==14.6.0
66 67 py-gfm==0.1.3
67 68 recaptcha-client==1.0.6
68 69 redis==2.10.6
69 70 repoze.lru==0.7
70 71 requests==2.9.1
71 Routes==1.13
72 Routes==2.4.1
72 73 setproctitle==1.1.10
73 74 simplejson==3.11.1
74 75 six==1.11.0
@@ -92,10 +93,6 zope.deprecation==4.1.2
92 93 zope.event==4.0.3
93 94 zope.interface==4.1.3
94 95
95 ## customized/patched libs
96 # our patched version of Pylons==1.0.2
97 https://code.rhodecode.com/upstream/pylons/archive/707354ee4261b9c10450404fc9852ccea4fd667d.tar.gz?md5=f26633726fa2cd3a340316ee6a5d218f#egg=Pylons==1.0.2.rhodecode-patch-1
98
99 96
100 97 # IPYTHON RENDERING
101 98 # entrypoints backport, pypi version doesn't support egg installs
@@ -27,7 +27,7 from rhodecode.tests import TEST_USER_AD
27 27
28 28
29 29 @pytest.fixture(scope="class")
30 def testuser_api(request, pylonsapp):
30 def testuser_api(request, baseapp):
31 31 cls = request.cls
32 32
33 33 # ADMIN USER
@@ -159,32 +159,14 class BaseAppView(object):
159 159
160 160 return c
161 161
162 def _register_global_c(self, tmpl_args):
163 """
164 Registers attributes to pylons global `c`
165 """
166
167 # TODO(marcink): remove once pyramid migration is finished
168 from pylons import tmpl_context as c
169 try:
170 for k, v in tmpl_args.items():
171 setattr(c, k, v)
172 except TypeError:
173 log.exception('Failed to register pylons C')
174 pass
175
176 def _get_template_context(self, tmpl_args):
177 self._register_global_c(tmpl_args)
162 def _get_template_context(self, tmpl_args, **kwargs):
178 163
179 164 local_tmpl_args = {
180 165 'defaults': {},
181 166 'errors': {},
182 # register a fake 'c' to be used in templates instead of global
183 # pylons c, after migration to pyramid we should rename it to 'c'
184 # make sure we replace usage of _c in templates too
185 '_c': tmpl_args
167 'c': tmpl_args
186 168 }
187 local_tmpl_args.update(tmpl_args)
169 local_tmpl_args.update(kwargs)
188 170 return local_tmpl_args
189 171
190 172 def load_default_context(self):
@@ -194,7 +176,7 class BaseAppView(object):
194 176 def load_default_context(self):
195 177 c = self._get_local_tmpl_context()
196 178 c.custom_var = 'foobar'
197 self._register_global_c(c)
179
198 180 return c
199 181 """
200 182 raise NotImplementedError('Needs implementation in view class')
@@ -213,7 +195,7 class RepoAppView(BaseAppView):
213 195 'Requirements are missing for repository %s: %s',
214 196 self.db_repo_name, error.message)
215 197
216 def _get_local_tmpl_context(self, include_app_defaults=False):
198 def _get_local_tmpl_context(self, include_app_defaults=True):
217 199 _ = self.request.translate
218 200 c = super(RepoAppView, self)._get_local_tmpl_context(
219 201 include_app_defaults=include_app_defaults)
@@ -336,7 +318,7 class BaseReferencesView(RepoAppView):
336 318 def load_default_context(self):
337 319 c = self._get_local_tmpl_context()
338 320
339 self._register_global_c(c)
321
340 322 return c
341 323
342 324 def load_refs_context(self, ref_items, partials_template):
@@ -25,7 +25,6 import collections
25 25 from zope.interface import implementer
26 26
27 27 from rhodecode.apps.admin.interfaces import IAdminNavigationRegistry
28 from rhodecode.lib.utils import get_registry
29 28 from rhodecode.lib.utils2 import str2bool
30 29 from rhodecode.translation import _
31 30
@@ -116,7 +115,7 def navigation_registry(request, registr
116 115 """
117 116 Helper that returns the admin navigation registry.
118 117 """
119 pyramid_registry = registry or get_registry(request)
118 pyramid_registry = registry or request.registry
120 119 nav_registry = pyramid_registry.queryUtility(IAdminNavigationRegistry)
121 120 return nav_registry
122 121
@@ -46,10 +46,11 def route_path(name, params=None, **kwar
46 46 return base_url
47 47
48 48
49 class TestAdminController(TestController):
49 @pytest.mark.usefixtures('app')
50 class TestAdminController(object):
50 51
51 52 @pytest.fixture(scope='class', autouse=True)
52 def prepare(self, request, pylonsapp):
53 def prepare(self, request, baseapp):
53 54 UserLog.query().delete()
54 55 Session().commit()
55 56
@@ -84,104 +85,87 class TestAdminController(TestController
84 85 UserLog.query().delete()
85 86 Session().commit()
86 87
87 def test_index(self):
88 self.log_user()
88 def test_index(self, autologin_user):
89 89 response = self.app.get(route_path('admin_audit_logs'))
90 90 response.mustcontain('Admin audit logs')
91 91
92 def test_filter_all_entries(self):
93 self.log_user()
92 def test_filter_all_entries(self, autologin_user):
94 93 response = self.app.get(route_path('admin_audit_logs'))
95 94 all_count = UserLog.query().count()
96 95 response.mustcontain('%s entries' % all_count)
97 96
98 def test_filter_journal_filter_exact_match_on_repository(self):
99 self.log_user()
97 def test_filter_journal_filter_exact_match_on_repository(self, autologin_user):
100 98 response = self.app.get(route_path('admin_audit_logs',
101 99 params=dict(filter='repository:rhodecode')))
102 100 response.mustcontain('3 entries')
103 101
104 def test_filter_journal_filter_exact_match_on_repository_CamelCase(self):
105 self.log_user()
102 def test_filter_journal_filter_exact_match_on_repository_CamelCase(self, autologin_user):
106 103 response = self.app.get(route_path('admin_audit_logs',
107 104 params=dict(filter='repository:RhodeCode')))
108 105 response.mustcontain('3 entries')
109 106
110 def test_filter_journal_filter_wildcard_on_repository(self):
111 self.log_user()
107 def test_filter_journal_filter_wildcard_on_repository(self, autologin_user):
112 108 response = self.app.get(route_path('admin_audit_logs',
113 109 params=dict(filter='repository:*test*')))
114 110 response.mustcontain('862 entries')
115 111
116 def test_filter_journal_filter_prefix_on_repository(self):
117 self.log_user()
112 def test_filter_journal_filter_prefix_on_repository(self, autologin_user):
118 113 response = self.app.get(route_path('admin_audit_logs',
119 114 params=dict(filter='repository:test*')))
120 115 response.mustcontain('257 entries')
121 116
122 def test_filter_journal_filter_prefix_on_repository_CamelCase(self):
123 self.log_user()
117 def test_filter_journal_filter_prefix_on_repository_CamelCase(self, autologin_user):
124 118 response = self.app.get(route_path('admin_audit_logs',
125 119 params=dict(filter='repository:Test*')))
126 120 response.mustcontain('257 entries')
127 121
128 def test_filter_journal_filter_prefix_on_repository_and_user(self):
129 self.log_user()
122 def test_filter_journal_filter_prefix_on_repository_and_user(self, autologin_user):
130 123 response = self.app.get(route_path('admin_audit_logs',
131 124 params=dict(filter='repository:test* AND username:demo')))
132 125 response.mustcontain('130 entries')
133 126
134 def test_filter_journal_filter_prefix_on_repository_or_target_repo(self):
135 self.log_user()
127 def test_filter_journal_filter_prefix_on_repository_or_target_repo(self, autologin_user):
136 128 response = self.app.get(route_path('admin_audit_logs',
137 129 params=dict(filter='repository:test* OR repository:rhodecode')))
138 130 response.mustcontain('260 entries') # 257 + 3
139 131
140 def test_filter_journal_filter_exact_match_on_username(self):
141 self.log_user()
132 def test_filter_journal_filter_exact_match_on_username(self, autologin_user):
142 133 response = self.app.get(route_path('admin_audit_logs',
143 134 params=dict(filter='username:demo')))
144 135 response.mustcontain('1087 entries')
145 136
146 def test_filter_journal_filter_exact_match_on_username_camelCase(self):
147 self.log_user()
137 def test_filter_journal_filter_exact_match_on_username_camelCase(self, autologin_user):
148 138 response = self.app.get(route_path('admin_audit_logs',
149 139 params=dict(filter='username:DemO')))
150 140 response.mustcontain('1087 entries')
151 141
152 def test_filter_journal_filter_wildcard_on_username(self):
153 self.log_user()
142 def test_filter_journal_filter_wildcard_on_username(self, autologin_user):
154 143 response = self.app.get(route_path('admin_audit_logs',
155 144 params=dict(filter='username:*test*')))
156 145 entries_count = UserLog.query().filter(UserLog.username.ilike('%test%')).count()
157 146 response.mustcontain('{} entries'.format(entries_count))
158 147
159 def test_filter_journal_filter_prefix_on_username(self):
160 self.log_user()
148 def test_filter_journal_filter_prefix_on_username(self, autologin_user):
161 149 response = self.app.get(route_path('admin_audit_logs',
162 150 params=dict(filter='username:demo*')))
163 151 response.mustcontain('1101 entries')
164 152
165 def test_filter_journal_filter_prefix_on_user_or_other_user(self):
166 self.log_user()
153 def test_filter_journal_filter_prefix_on_user_or_other_user(self, autologin_user):
167 154 response = self.app.get(route_path('admin_audit_logs',
168 155 params=dict(filter='username:demo OR username:volcan')))
169 156 response.mustcontain('1095 entries') # 1087 + 8
170 157
171 def test_filter_journal_filter_wildcard_on_action(self):
172 self.log_user()
158 def test_filter_journal_filter_wildcard_on_action(self, autologin_user):
173 159 response = self.app.get(route_path('admin_audit_logs',
174 160 params=dict(filter='action:*pull_request*')))
175 161 response.mustcontain('187 entries')
176 162
177 def test_filter_journal_filter_on_date(self):
178 self.log_user()
163 def test_filter_journal_filter_on_date(self, autologin_user):
179 164 response = self.app.get(route_path('admin_audit_logs',
180 165 params=dict(filter='date:20121010')))
181 166 response.mustcontain('47 entries')
182 167
183 def test_filter_journal_filter_on_date_2(self):
184 self.log_user()
168 def test_filter_journal_filter_on_date_2(self, autologin_user):
185 169 response = self.app.get(route_path('admin_audit_logs',
186 170 params=dict(filter='date:20121020')))
187 171 response.mustcontain('17 entries')
@@ -429,7 +429,7 class TestAdminSettingsVcs(object):
429 429 # TODO: johbo: What we really want is to checkpoint before a test run and
430 430 # reset the session afterwards.
431 431 @pytest.fixture(scope='class', autouse=True)
432 def cleanup_settings(self, request, pylonsapp):
432 def cleanup_settings(self, request, baseapp):
433 433 ui_id = RhodeCodeUi.ui_id
434 434 original_ids = list(
435 435 r.ui_id for r in RhodeCodeUi.query().values(ui_id))
@@ -23,7 +23,6 from sqlalchemy.orm.exc import NoResultF
23 23
24 24 from rhodecode.lib import auth
25 25 from rhodecode.lib import helpers as h
26 from rhodecode.model import validators
27 26 from rhodecode.model.db import User, UserApiKeys, UserEmailMap, Repository
28 27 from rhodecode.model.meta import Session
29 28 from rhodecode.model.user import UserModel
@@ -386,8 +385,7 class TestAdminUsersView(TestController)
386 385 'csrf_token': self.csrf_token,
387 386 })
388 387
389 msg = validators.ValidUsername(
390 False, {})._messages['system_invalid_username']
388 msg = '???'
391 389 msg = h.html_escape(msg % {'username': 'new_user'})
392 390 response.mustcontain('<span class="error-message">%s</span>' % msg)
393 391 response.mustcontain(
@@ -36,7 +36,6 log = logging.getLogger(__name__)
36 36 class AdminAuditLogsView(BaseAppView):
37 37 def load_default_context(self):
38 38 c = self._get_local_tmpl_context()
39 self._register_global_c(c)
40 39 return c
41 40
42 41 @LoginRequired()
@@ -44,7 +44,7 class AdminDefaultSettingsView(BaseAppVi
44 44 def load_default_context(self):
45 45 c = self._get_local_tmpl_context()
46 46
47 self._register_global_c(c)
47
48 48 return c
49 49
50 50 @LoginRequired()
@@ -79,7 +79,7 class AdminDefaultSettingsView(BaseAppVi
79 79 _ = self.request.translate
80 80 c = self.load_default_context()
81 81 c.active = 'repositories'
82 form = DefaultsForm()()
82 form = DefaultsForm(self.request.translate)()
83 83
84 84 try:
85 85 form_result = form.to_python(dict(self.request.POST))
@@ -35,7 +35,7 class OpenSourceLicensesAdminSettingsVie
35 35
36 36 def load_default_context(self):
37 37 c = self._get_local_tmpl_context()
38 self._register_global_c(c)
38
39 39 return c
40 40
41 41 @LoginRequired()
@@ -54,7 +54,7 class AdminPermissionsView(BaseAppView,
54 54 def load_default_context(self):
55 55 c = self._get_local_tmpl_context()
56 56
57 self._register_global_c(c)
57
58 58 PermissionModel().set_global_permission_choices(
59 59 c, gettext_translator=self.request.translate)
60 60 return c
@@ -100,6 +100,7 class AdminPermissionsView(BaseAppView,
100 100 c.active = 'application'
101 101
102 102 _form = ApplicationPermissionsForm(
103 self.request.translate,
103 104 [x[0] for x in c.register_choices],
104 105 [x[0] for x in c.password_reset_choices],
105 106 [x[0] for x in c.extern_activate_choices])()
@@ -180,6 +181,7 class AdminPermissionsView(BaseAppView,
180 181 c.active = 'objects'
181 182
182 183 _form = ObjectPermissionsForm(
184 self.request.translate,
183 185 [x[0] for x in c.repo_perms_choices],
184 186 [x[0] for x in c.group_perms_choices],
185 187 [x[0] for x in c.user_group_perms_choices])()
@@ -251,6 +253,7 class AdminPermissionsView(BaseAppView,
251 253 c.active = 'global'
252 254
253 255 _form = UserPermissionsForm(
256 self.request.translate,
254 257 [x[0] for x in c.repo_create_choices],
255 258 [x[0] for x in c.repo_create_on_write_choices],
256 259 [x[0] for x in c.repo_group_create_choices],
@@ -395,6 +398,7 class AdminPermissionsView(BaseAppView,
395 398 renderer='json_ext', xhr=True)
396 399 def ssh_keys_data(self):
397 400 _ = self.request.translate
401 self.load_default_context()
398 402 column_map = {
399 403 'fingerprint': 'ssh_key_fingerprint',
400 404 'username': User.username
@@ -35,7 +35,7 log = logging.getLogger(__name__)
35 35 class AdminProcessManagementView(BaseAppView):
36 36 def load_default_context(self):
37 37 c = self._get_local_tmpl_context()
38 self._register_global_c(c)
38
39 39 return c
40 40
41 41 @LoginRequired()
@@ -47,7 +47,7 class AdminRepoGroupsView(BaseAppView, D
47 47
48 48 def load_default_context(self):
49 49 c = self._get_local_tmpl_context()
50 self._register_global_c(c)
50
51 51 return c
52 52
53 53 def _load_form_data(self, c):
@@ -150,8 +150,9 class AdminRepoGroupsView(BaseAppView, D
150 150 # permissions for can create group based on parent_id are checked
151 151 # here in the Form
152 152 available_groups = map(lambda k: safe_unicode(k[0]), c.repo_groups)
153 repo_group_form = RepoGroupForm(available_groups=available_groups,
154 can_create_in_root=can_create)()
153 repo_group_form = RepoGroupForm(
154 self.request.translate, available_groups=available_groups,
155 can_create_in_root=can_create)()
155 156
156 157 repo_group_name = self.request.POST.get('group_name')
157 158 try:
@@ -49,7 +49,7 class AdminReposView(BaseAppView, DataGr
49 49
50 50 def load_default_context(self):
51 51 c = self._get_local_tmpl_context()
52 self._register_global_c(c)
52
53 53 return c
54 54
55 55 def _load_form_data(self, c):
@@ -148,9 +148,10 class AdminReposView(BaseAppView, DataGr
148 148
149 149 try:
150 150 # CanWriteToGroup validators checks permissions of this POST
151 form_result = RepoForm(repo_groups=c.repo_groups_choices,
152 landing_revs=c.landing_revs_choices)()\
153 .to_python(dict(self.request.POST))
151 form = RepoForm(
152 self.request.translate, repo_groups=c.repo_groups_choices,
153 landing_revs=c.landing_revs_choices)()
154 form_results = form.to_python(dict(self.request.POST))
154 155
155 156 # create is done sometimes async on celery, db transaction
156 157 # management is handled there.
@@ -39,7 +39,7 class AdminSessionSettingsView(BaseAppVi
39 39 def load_default_context(self):
40 40 c = self._get_local_tmpl_context()
41 41
42 self._register_global_c(c)
42
43 43 return c
44 44
45 45 @LoginRequired()
@@ -67,7 +67,7 class AdminSettingsView(BaseAppView):
67 67 c.labs_active = str2bool(
68 68 rhodecode.CONFIG.get('labs_settings_active', 'true'))
69 69 c.navlist = navigation_list(self.request)
70 self._register_global_c(c)
70
71 71 return c
72 72
73 73 @classmethod
@@ -153,7 +153,7 class AdminSettingsView(BaseAppView):
153 153 settings = self.request.registry.settings
154 154 c.svn_proxy_generate_config = settings[generate_config]
155 155
156 application_form = ApplicationUiSettingsForm()()
156 application_form = ApplicationUiSettingsForm(self.request.translate)()
157 157
158 158 try:
159 159 form_result = application_form.to_python(dict(self.request.POST))
@@ -310,7 +310,7 class AdminSettingsView(BaseAppView):
310 310 c.active = 'global'
311 311 c.personal_repo_group_default_pattern = RepoGroupModel()\
312 312 .get_personal_group_name_pattern()
313 application_form = ApplicationSettingsForm()()
313 application_form = ApplicationSettingsForm(self.request.translate)()
314 314 try:
315 315 form_result = application_form.to_python(dict(self.request.POST))
316 316 except formencode.Invalid as errors:
@@ -382,7 +382,7 class AdminSettingsView(BaseAppView):
382 382 _ = self.request.translate
383 383 c = self.load_default_context()
384 384 c.active = 'visual'
385 application_form = ApplicationVisualisationForm()()
385 application_form = ApplicationVisualisationForm(self.request.translate)()
386 386 try:
387 387 form_result = application_form.to_python(dict(self.request.POST))
388 388 except formencode.Invalid as errors:
@@ -482,7 +482,7 class AdminSettingsView(BaseAppView):
482 482 settings_model = IssueTrackerSettingsModel()
483 483
484 484 try:
485 form = IssueTrackerPatternsForm()().to_python(self.request.POST)
485 form = IssueTrackerPatternsForm(self.request.translate)().to_python(self.request.POST)
486 486 except formencode.Invalid as errors:
487 487 log.exception('Failed to add new pattern')
488 488 error = errors
@@ -698,7 +698,7 class AdminSettingsView(BaseAppView):
698 698 c = self.load_default_context()
699 699 c.active = 'labs'
700 700
701 application_form = LabsSettingsForm()()
701 application_form = LabsSettingsForm(self.request.translate)()
702 702 try:
703 703 form_result = application_form.to_python(dict(self.request.POST))
704 704 except formencode.Invalid as errors:
@@ -40,7 +40,7 log = logging.getLogger(__name__)
40 40 class AdminSystemInfoSettingsView(BaseAppView):
41 41 def load_default_context(self):
42 42 c = self._get_local_tmpl_context()
43 self._register_global_c(c)
43
44 44 return c
45 45
46 46 @staticmethod
@@ -53,7 +53,7 class AdminUserGroupsView(BaseAppView, D
53 53 PermissionModel().set_global_permission_choices(
54 54 c, gettext_translator=self.request.translate)
55 55
56 self._register_global_c(c)
56
57 57 return c
58 58
59 59 # permission check in data loading of
@@ -196,7 +196,7 class AdminUserGroupsView(BaseAppView, D
196 196 def user_groups_create(self):
197 197 _ = self.request.translate
198 198 c = self.load_default_context()
199 users_group_form = UserGroupForm()()
199 users_group_form = UserGroupForm(self.request.translate)()
200 200
201 201 user_group_name = self.request.POST.get('users_group_name')
202 202 try:
@@ -44,7 +44,8 from rhodecode.lib import helpers as h
44 44 from rhodecode.lib.utils2 import safe_int, safe_unicode, AttributeDict
45 45 from rhodecode.model.auth_token import AuthTokenModel
46 46 from rhodecode.model.forms import (
47 UserForm, UserIndividualPermissionsForm, UserPermissionsForm)
47 UserForm, UserIndividualPermissionsForm, UserPermissionsForm,
48 UserExtraEmailForm, UserExtraIpForm)
48 49 from rhodecode.model.permission import PermissionModel
49 50 from rhodecode.model.repo_group import RepoGroupModel
50 51 from rhodecode.model.ssh_key import SshKeyModel
@@ -62,7 +63,6 class AdminUsersView(BaseAppView, DataGr
62 63
63 64 def load_default_context(self):
64 65 c = self._get_local_tmpl_context()
65 self._register_global_c(c)
66 66 return c
67 67
68 68 @LoginRequired()
@@ -191,7 +191,7 class AdminUsersView(BaseAppView, DataGr
191 191 c = self.load_default_context()
192 192 c.default_extern_type = auth_rhodecode.RhodeCodeAuthPlugin.name
193 193 user_model = UserModel()
194 user_form = UserForm()()
194 user_form = UserForm(self.request.translate)()
195 195 try:
196 196 form_result = user_form.to_python(dict(self.request.POST))
197 197 user = user_model.create(form_result)
@@ -259,7 +259,7 class UsersView(UserAppView):
259 259 PermissionModel().set_global_permission_choices(
260 260 c, gettext_translator=req.translate)
261 261
262 self._register_global_c(c)
262
263 263 return c
264 264
265 265 @LoginRequired()
@@ -280,7 +280,8 class UsersView(UserAppView):
280 280 c.extern_name = c.user.extern_name
281 281 c.perm_user = c.user.AuthUser(ip_addr=self.request.remote_addr)
282 282 available_languages = [x[0] for x in c.allowed_languages]
283 _form = UserForm(edit=True, available_languages=available_languages,
283 _form = UserForm(self.request.translate, edit=True,
284 available_languages=available_languages,
284 285 old_data={'user_id': user_id,
285 286 'email': c.user.email})()
286 287 form_result = {}
@@ -538,7 +539,7 class UsersView(UserAppView):
538 539 c.active = 'global_perms'
539 540 try:
540 541 # first stage that verifies the checkbox
541 _form = UserIndividualPermissionsForm()
542 _form = UserIndividualPermissionsForm(self.request.translate)
542 543 form_result = _form.to_python(dict(self.request.POST))
543 544 inherit_perms = form_result['inherit_default_permissions']
544 545 c.user.inherit_default_permissions = inherit_perms
@@ -547,6 +548,7 class UsersView(UserAppView):
547 548 if not inherit_perms:
548 549 # only update the individual ones if we un check the flag
549 550 _form = UserPermissionsForm(
551 self.request.translate,
550 552 [x[0] for x in c.repo_create_choices],
551 553 [x[0] for x in c.repo_create_on_write_choices],
552 554 [x[0] for x in c.repo_group_create_choices],
@@ -914,6 +916,11 class UsersView(UserAppView):
914 916 email = self.request.POST.get('new_email')
915 917 user_data = c.user.get_api_data()
916 918 try:
919
920 form = UserExtraEmailForm(self.request.translate)()
921 data = form.to_python({'email': email})
922 email = data['email']
923
917 924 UserModel().add_extra_email(c.user.user_id, email)
918 925 audit_logger.store_web(
919 926 'user.edit.email.add',
@@ -1009,6 +1016,10 class UsersView(UserAppView):