From: Ɓukasz Rekucki Date: Mon, 15 Mar 2010 13:02:43 +0000 (+0100) Subject: Unicode errors in gallery, colors, added south, removal. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/ba6fd3dfb0d3241d4ce85fa43cd6e760d17db948 Unicode errors in gallery, colors, added south, removal. --- diff --git a/apps/wiki/views.py b/apps/wiki/views.py index dd3991fe..df693737 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -8,6 +8,7 @@ from django.utils import simplejson as json from wiki.models import storage, Document, DocumentNotFound from wiki.forms import DocumentForm from datetime import datetime +from django.utils.encoding import smart_unicode # import google_diff # import difflib @@ -65,8 +66,24 @@ def document_detail(request, name, template_name = 'wiki/document_details.html') def document_gallery(request, directory): try: - base_dir = os.path.join(settings.MEDIA_ROOT, settings.FILEBROWSER_DIRECTORY, directory) - images = [u'%s%s%s/%s' % (settings.MEDIA_URL, settings.FILEBROWSER_DIRECTORY, directory, f) for f in os.listdir(base_dir) if os.path.splitext(f)[1].lower() in (u'.jpg', u'.jpeg', u'.png')] + base_dir = os.path.join( + smart_unicode(settings.MEDIA_ROOT), + smart_unicode(settings.FILEBROWSER_DIRECTORY), + smart_unicode(directory) ) + + def map_to_url(filename): + + return '%s%s%s/%s' % ( + smart_unicode(settings.MEDIA_URL), + smart_unicode(settings.FILEBROWSER_DIRECTORY), + smart_unicode(directory), + smart_unicode(filename) + ) + + def is_image(filename): + return os.path.splitext(f)[1].lower() in (u'.jpg', u'.jpeg', u'.png') + + images = [ map_to_url(f) for f in map(smart_unicode, os.listdir(base_dir)) if is_image(f) ] images.sort() return HttpResponse(json.dumps(images)) except (IndexError, OSError), exc: diff --git a/platforma/settings.py b/platforma/settings.py index 628b4eff..a116a44a 100644 --- a/platforma/settings.py +++ b/platforma/settings.py @@ -171,10 +171,11 @@ INSTALLED_APPS = ( 'debug_toolbar', 'compress', - - 'wiki', + 'south', 'sorl.thumbnail', 'filebrowser', + + 'wiki', 'toolbar', ) diff --git a/platforma/static/css/xmlcolors.css b/platforma/static/css/xmlcolors.css index 1b602591..5a2d7ccc 100644 --- a/platforma/static/css/xmlcolors.css +++ b/platforma/static/css/xmlcolors.css @@ -22,7 +22,7 @@ } span.xml-tagname { - color: #a31727; + color: #0e5f0e; } span.xml-attribute { @@ -55,6 +55,7 @@ span.xml-entity { span.xml-error { color: #F00; + font-weight: bolder; } span.xml-text { diff --git a/platforma/static/js/xslt.js b/platforma/static/js/xslt.js index f5af909b..566b0a80 100644 --- a/platforma/static/js/xslt.js +++ b/platforma/static/js/xslt.js @@ -236,6 +236,11 @@ HTMLSerializer.prototype.serialize = function(rootElement, stripOuter) break; }; + if(xnode === 'out-of-flow-text') { + self._pushChildren(token.node); + break; + } + if(token.node.hasAttribute('x-verse') && self._verseBefore(token.node)) { self.result += '/\n'; }; diff --git a/requirements.txt b/requirements.txt index 975ceb77..9c9509af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,10 @@ mercurial>=1.3.1 librarian>=1.3.dev,<1.4 PyYAML>=3.0 # MySQL-python>=1.2,<2.0 + +# migrations +south>=0.6 + # debug stuff django-nose>=0.0.3 django-debug-toolbar>=0.8