allura
Revisión | 5dabae7e29dd188e54c8b54db626aaff63346751 (tree) |
---|---|
Tiempo | 2012-04-23 22:51:22 |
Autor | Dave Brondsema <dbrondsema@geek...> |
Commiter | Dave Brondsema |
[#4065] remove tidylib dependency (no xhtml validation needed)
@@ -62,7 +62,7 @@ setup( | ||
62 | 62 | packages=find_packages(exclude=['ez_setup']), |
63 | 63 | include_package_data=True, |
64 | 64 | test_suite='nose.collector', |
65 | - tests_require=['WebTest >= 1.2', 'BeautifulSoup', 'pytidylib', 'poster', 'nose'], | |
65 | + tests_require=['WebTest >= 1.2', 'BeautifulSoup', 'poster', 'nose'], | |
66 | 66 | package_data={'allura': ['i18n/*/LC_MESSAGES/*.mo', |
67 | 67 | 'templates/*/*', |
68 | 68 | 'public/*/*']}, |
@@ -20,7 +20,6 @@ from paste.script.appinstall import SetupCommand | ||
20 | 20 | from pylons import c, g, url, request, response, session |
21 | 21 | from webtest import TestApp |
22 | 22 | from webob import Request, Response |
23 | -from tidylib import tidy_document | |
24 | 23 | from nose.tools import ok_, assert_true, assert_false |
25 | 24 | from poster.encode import multipart_encode |
26 | 25 | from poster.streaminghttp import register_openers |
@@ -110,70 +109,11 @@ def validate_html(html_or_response): | ||
110 | 109 | |
111 | 110 | html = html.lstrip() |
112 | 111 | |
113 | - if html.startswith('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'): | |
114 | - return validate_xhtml(html) | |
115 | - elif html.startswith('<!DOCTYPE html>'): | |
112 | + if html.startswith('<!DOCTYPE html>'): | |
116 | 113 | return validate_html5(html) |
117 | 114 | else: |
118 | 115 | assert False, 'Non-valid HTML: ' + html[:100] + '...' |
119 | 116 | |
120 | -def validate_xhtml(html): | |
121 | - ok_warnings = ('inserting implicit <span>', | |
122 | - 'replacing unexpected button by </button>', | |
123 | - 'missing </button>', | |
124 | - 'trimming empty <', | |
125 | - '<form> lacks "action" attribute', | |
126 | - 'replacing invalid character code', | |
127 | - 'discarding invalid character code', | |
128 | - '<a> proprietary attribute "alt"', # event RSS feed generated this | |
129 | - '<table> lacks "summary" attribute', | |
130 | - | |
131 | - # parser appears to get mightily confused | |
132 | - # see also http://sourceforge.net/tracker/?func=detail&atid=390963&aid=1986717&group_id=27659 | |
133 | - '<span> anchor "login_openid" already defined', | |
134 | - ) | |
135 | - | |
136 | - doc_tidied, errors = tidy_document(html) | |
137 | - if errors: | |
138 | - lines = html.split('\n') | |
139 | - #print html | |
140 | - errors_prettified = "" | |
141 | - for e in errors.split('\n'): | |
142 | - if not e: | |
143 | - continue | |
144 | - if '- Warning: ' in e: | |
145 | - ok = False | |
146 | - for ok_warning in ok_warnings: | |
147 | - if ok_warning in e: | |
148 | - ok = True | |
149 | - continue | |
150 | - if ok: | |
151 | - continue | |
152 | - if '- Info:' in e: | |
153 | - continue | |
154 | - if '- Info:' in e: | |
155 | - continue | |
156 | - line_num = int(e.split(' ',2)[1]) | |
157 | - errors_prettified += e + "\n" | |
158 | - for offset in range(-2,2+1): | |
159 | - try: | |
160 | - errors_prettified += "%s: %s\n" % (line_num+offset, lines[line_num+offset-1]) | |
161 | - except IndexError as e: | |
162 | - pass | |
163 | - #print lines[line_num-1] | |
164 | - errors_prettified += "\n" | |
165 | - assert_false(errors_prettified, "HTML Tidy errors:\n" + errors_prettified) | |
166 | - | |
167 | -def validate_xhtml_chunk(html): | |
168 | - """ When you don't have a html & body tags - this adds it""" | |
169 | - html = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
170 | - <html xmlns="http://www.w3.org/1999/xhtml"> | |
171 | - <head><title></title></head> | |
172 | - <body> | |
173 | - %s | |
174 | - </body></html>''' % html | |
175 | - return validate_xhtml(html) | |
176 | - | |
177 | 117 | def validate_json(json_or_response): |
178 | 118 | if hasattr(json_or_response, 'body'): |
179 | 119 | j = json_or_response.body |
@@ -16,7 +16,6 @@ setup(name='AlluraTesting', | ||
16 | 16 | include_package_data=True, |
17 | 17 | zip_safe=False, |
18 | 18 | install_requires=[ |
19 | - 'pytidylib', | |
20 | 19 | "poster", |
21 | 20 | # -*- Extra requirements: -*- |
22 | 21 | ] |
@@ -19,7 +19,7 @@ We'll use [VirtualBox](http://www.virtualbox.org) and [Ubuntu 11.10](http://ubun | ||
19 | 19 | |
20 | 20 | Before we begin, you'll need the following additional packages in order to work with the Forge source code. |
21 | 21 | |
22 | - ~$ sudo aptitude install git-core subversion python-svn libtidy-0.99-0 | |
22 | + ~$ sudo aptitude install git-core subversion python-svn | |
23 | 23 | |
24 | 24 | You'll also need additional development packages in order to compile some of the modules. [Use google for additional PIL/jpeg help.](http://www.google.com/search?q=ubuntu+pil+jpeg+virtualenv) |
25 | 25 |