Skip to content
Browse files

Don't strip attributes for <img>s, update blog link.

  • Loading branch information...
1 parent b184522 commit dcc8298a3fd9b66c926a416792c72b5edff0b418 @tomdyson committed Sep 8, 2011
Showing with 43 additions and 3 deletions.
  1. 0 __init__.py
  2. +40 −0 rolling.py
  3. +1 −1 templates/base.html
  4. +2 −2 wordoff.py
View
0 __init__.py
No changes.
View
40 rolling.py
@@ -0,0 +1,40 @@
+# wsgi stub for django on app engine
+
+import logging, os
+
+# Google App Engine imports.
+from google.appengine.ext.webapp import util
+
+# Force Django to reload its settings.
+from django.conf import settings
+settings._target = None
+
+# Must set this env var before importing any part of Django
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+
+import logging
+import django.core.handlers.wsgi
+import django.core.signals
+import django.db
+import django.dispatch.dispatcher
+
+def log_exception(*args, **kwds):
+ logging.exception('Exception in request:')
+
+# Log errors.
+django.dispatch.dispatcher.connect(log_exception, django.core.signals.got_request_exception)
+
+# Unregister the rollback event handler.
+django.dispatch.dispatcher.disconnect(
+ django.db._rollback_on_exception,
+ django.core.signals.got_request_exception)
+
+def main():
+ # Create a Django application for WSGI.
+ application = django.core.handlers.wsgi.WSGIHandler()
+
+ # Run the WSGI CGI handler with that application.
+ util.run_wsgi_app(application)
+
+if __name__ == '__main__':
+ main()
View
2 templates/base.html
@@ -26,7 +26,7 @@
<a href = "/">start</a> |
<a href="/about">about</a> |
<a href="/api">api</a> |
- &copy; <a href = "http://www.throwingbeans.org/">tom dyson</a> 2008
+ &copy; <a href = "http://tomdyson.org/">tom dyson</a> 2008
</div>
</div>
View
4 wordoff.py
@@ -11,8 +11,8 @@
match_multiple_linebreaks = re.compile(r'(\n\s*){3,}')
def ignore_some_tags(matchobj):
- # don't strip attributes for <a>s
- if matchobj.group(1) == 'a':
+ # don't strip attributes for <a>s or <img>s
+ if matchobj.group(1) in ['a','img']:
return matchobj.group(0)
else:
return '<%s>' % matchobj.group(1)

0 comments on commit dcc8298

Please sign in to comment.
Something went wrong with that request. Please try again.