allura
修訂 | 65998180594055f7d353f1c0629e2c81db3dd86f (tree) |
---|---|
時間 | 2011-10-07 05:41:45 |
作者 | Rick Copeland <rcopeland@geek...> |
Commiter | Rick Copeland |
[#2020] working on getting environment more sane
Signed-off-by: Rick Copeland <rcopeland@geek.net>
@@ -1,6 +1,13 @@ | ||
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | """WSGI environment setup for allura.""" |
3 | 3 | |
4 | +import pylons | |
5 | +import pylons.middleware | |
6 | +import tg | |
7 | +import tg.error | |
8 | +pylons.c = pylons.tmpl_context | |
9 | +pylons.g = pylons.app_globals | |
10 | + | |
4 | 11 | from allura.config.app_cfg import base_config |
5 | 12 | |
6 | 13 | __all__ = ['load_environment'] |
@@ -2,7 +2,12 @@ | ||
2 | 2 | """WSGI middleware initialization for the allura application.""" |
3 | 3 | import mimetypes |
4 | 4 | |
5 | +import pylons | |
6 | +import pylons.middleware | |
5 | 7 | import tg |
8 | +import tg.error | |
9 | +pylons.c = pylons.tmpl_context | |
10 | +pylons.g = pylons.app_globals | |
6 | 11 | import pkg_resources |
7 | 12 | from tg import config |
8 | 13 | from paste.deploy.converters import asbool |
@@ -13,7 +13,8 @@ import pylons | ||
13 | 13 | import webob.multidict |
14 | 14 | from formencode import Invalid |
15 | 15 | from tg.decorators import before_validate |
16 | -from pylons import response, c | |
16 | +from pylons import response | |
17 | +from pylons import tmpl_context as c | |
17 | 18 | from paste.httpheaders import CACHE_CONTROL, EXPIRES |
18 | 19 | from webhelpers.html import literal |
19 | 20 | from webob import exc |
@@ -15,7 +15,7 @@ | ||
15 | 15 | </label> |
16 | 16 | </div> |
17 | 17 | <div class="grid-10">{{widget.display_field(widget.fields.project_unixname)}} |
18 | - <br/><div id="project_url">http://{{c.environ['HTTP_HOST']}}{{neighborhood.url()}}<span id="url_fragment"></span></div> | |
18 | + <br/><div id="project_url">http://{{request.environ['HTTP_HOST']}}{{neighborhood.url()}}<span id="url_fragment"></span></div> | |
19 | 19 | </div> |
20 | 20 | <div class="grid-9" style="position:relative; overflow:visible"> |
21 | 21 | <b id="error_icon" data-icon="!" class="allura" title="Caution">!</b> |
@@ -47,7 +47,7 @@ class TestRootController(TestController): | ||
47 | 47 | 'text/html,application/xhtml+xml,application/xml;q=0.9;text/plain;q=0.8,image/png,*/*;q=0.5' ] |
48 | 48 | for hdr in hdrs: |
49 | 49 | # malformed headers used to return 500, just make sure they don't now |
50 | - self.app.get('/', headers=dict(Accept=hdr)) | |
50 | + self.app.get('/', headers=dict(Accept=hdr), validate_skip=True) | |
51 | 51 | |
52 | 52 | def test_project_browse(self): |
53 | 53 | com_cat = M.ProjectCategory.query.find(dict(label='Communications')).first() |
@@ -62,7 +62,7 @@ def test_thread_methods(): | ||
62 | 62 | assert t.attachment_class() == M.DiscussionAttachment |
63 | 63 | p0 = t.post('This is a post') |
64 | 64 | p1 = t.post('This is another post') |
65 | - time.sleep(1) | |
65 | + time.sleep(0.25) | |
66 | 66 | p2 = t.post('This is a reply', parent_id=p0._id) |
67 | 67 | ThreadLocalORMSession.flush_all() |
68 | 68 | ThreadLocalORMSession.close_all() |
@@ -74,7 +74,9 @@ def test_thread_methods(): | ||
74 | 74 | posts0 = t.find_posts(page=0, limit=10, style='threaded') |
75 | 75 | posts1 = t.find_posts(page=0, limit=10, style='timestamp') |
76 | 76 | assert posts0 != posts1 |
77 | - posts2 = t.find_posts(page=0, limit=10, style='threaded', timestamp=p0.timestamp) | |
77 | + ts = p0.timestamp.replace( | |
78 | + microsecond=int(p0.timestamp.microsecond // 1000) * 1000) | |
79 | + posts2 = t.find_posts(page=0, limit=10, style='threaded', timestamp=ts) | |
78 | 80 | assert len(posts2) > 0 |
79 | 81 | |
80 | 82 | assert 'wiki/_discuss/' in t.url() |
@@ -6,7 +6,7 @@ except ImportError: | ||
6 | 6 | use_setuptools() |
7 | 7 | from setuptools import setup, find_packages |
8 | 8 | |
9 | -from allura.version import __version__ | |
9 | +exec open('allura/version.py').read() | |
10 | 10 | |
11 | 11 | PROJECT_DESCRIPTION=''' |
12 | 12 | Allura is an open source implementation of a software "forge", a web site |
@@ -38,10 +38,15 @@ setup( | ||
38 | 38 | 'License :: OSI Approved :: Apache Software License', |
39 | 39 | ], |
40 | 40 | install_requires=[ |
41 | - "TurboGears2 >= 2.1a1", | |
41 | + "TurboGears2", | |
42 | + "tg.devtools", | |
43 | + "pypeline", | |
44 | + "datadiff", | |
45 | + "BeautifulSoup", | |
42 | 46 | "PasteScript", |
43 | 47 | "Babel >= 0.9.4", |
44 | - "pymongo >= 1.7", | |
48 | + "pymongo >= 1.9,<2.0", | |
49 | + "jinja2", | |
45 | 50 | "pysolr", |
46 | 51 | "repoze.what-quickstart", |
47 | 52 | "sqlalchemy-migrate", |
@@ -51,20 +56,21 @@ setup( | ||
51 | 56 | "python-openid >= 2.2.4", |
52 | 57 | "python-dateutil >= 1.4.1", |
53 | 58 | "WebOb >= 0.9.8", |
54 | - "WebTest == 1.2", | |
59 | + "WebTest >= 1.2", | |
55 | 60 | "EasyWidgets >= 0.1.1", |
56 | 61 | "PIL >= 1.1.7", |
57 | 62 | "iso8601", |
58 | - "chardet == 1.0.1", | |
63 | + "chardet >= 1.0.1", | |
59 | 64 | "feedparser >= 5.0.1", |
60 | - "oauth2 == 1.2.0", | |
65 | + "oauth2 >= 1.2.0", | |
66 | + "Ming >= 0.2.2dev-20110930", | |
61 | 67 | ], |
62 | 68 | setup_requires=["PasteScript >= 1.7"], |
63 | 69 | paster_plugins=['PasteScript', 'Pylons', 'TurboGears2', 'tg.devtools', 'Ming'], |
64 | 70 | packages=find_packages(exclude=['ez_setup']), |
65 | 71 | include_package_data=True, |
66 | 72 | test_suite='nose.collector', |
67 | - tests_require=['WebTest >= 1.2', 'BeautifulSoup', 'pytidylib', 'poster'], | |
73 | + tests_require=['WebTest >= 1.2', 'BeautifulSoup', 'pytidylib', 'poster', 'nose'], | |
68 | 74 | package_data={'allura': ['i18n/*/LC_MESSAGES/*.mo', |
69 | 75 | 'templates/*/*', |
70 | 76 | 'public/*/*']}, |
@@ -17,7 +17,7 @@ import mock | ||
17 | 17 | import beaker.session |
18 | 18 | from paste.deploy import loadapp |
19 | 19 | from paste.script.appinstall import SetupCommand |
20 | -from pylons import c, g, h, url, request, response, session | |
20 | +from pylons import c, g, url, request, response, session | |
21 | 21 | from webtest import TestApp |
22 | 22 | from webob import Request, Response |
23 | 23 | from tidylib import tidy_document |
@@ -16,6 +16,8 @@ setup(name='AlluraTesting', | ||
16 | 16 | include_package_data=True, |
17 | 17 | zip_safe=False, |
18 | 18 | install_requires=[ |
19 | + 'pytidylib', | |
20 | + "poster", | |
19 | 21 | # -*- Extra requirements: -*- |
20 | 22 | ] |
21 | 23 | ) |