• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revisión5dabae7e29dd188e54c8b54db626aaff63346751 (tree)
Tiempo2012-04-23 22:51:22
AutorDave Brondsema <dbrondsema@geek...>
CommiterDave Brondsema

Log Message

[#4065] remove tidylib dependency (no xhtml validation needed)

Cambiar Resumen

Diferencia incremental

--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -62,7 +62,7 @@ setup(
6262 packages=find_packages(exclude=['ez_setup']),
6363 include_package_data=True,
6464 test_suite='nose.collector',
65- tests_require=['WebTest >= 1.2', 'BeautifulSoup', 'pytidylib', 'poster', 'nose'],
65+ tests_require=['WebTest >= 1.2', 'BeautifulSoup', 'poster', 'nose'],
6666 package_data={'allura': ['i18n/*/LC_MESSAGES/*.mo',
6767 'templates/*/*',
6868 'public/*/*']},
--- a/AlluraTesting/alluratest/validation.py
+++ b/AlluraTesting/alluratest/validation.py
@@ -20,7 +20,6 @@ from paste.script.appinstall import SetupCommand
2020 from pylons import c, g, url, request, response, session
2121 from webtest import TestApp
2222 from webob import Request, Response
23-from tidylib import tidy_document
2423 from nose.tools import ok_, assert_true, assert_false
2524 from poster.encode import multipart_encode
2625 from poster.streaminghttp import register_openers
@@ -110,70 +109,11 @@ def validate_html(html_or_response):
110109
111110 html = html.lstrip()
112111
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>'):
116113 return validate_html5(html)
117114 else:
118115 assert False, 'Non-valid HTML: ' + html[:100] + '...'
119116
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-
177117 def validate_json(json_or_response):
178118 if hasattr(json_or_response, 'body'):
179119 j = json_or_response.body
--- a/AlluraTesting/setup.py
+++ b/AlluraTesting/setup.py
@@ -16,7 +16,6 @@ setup(name='AlluraTesting',
1616 include_package_data=True,
1717 zip_safe=False,
1818 install_requires=[
19- 'pytidylib',
2019 "poster",
2120 # -*- Extra requirements: -*-
2221 ]
--- a/README.markdown
+++ b/README.markdown
@@ -19,7 +19,7 @@ We'll use [VirtualBox](http://www.virtualbox.org) and [Ubuntu 11.10](http://ubun
1919
2020 Before we begin, you'll need the following additional packages in order to work with the Forge source code.
2121
22- ~$ sudo aptitude install git-core subversion python-svn libtidy-0.99-0
22+ ~$ sudo aptitude install git-core subversion python-svn
2323
2424 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)
2525