Unicode errors in gallery, colors, added south, <out-of-flow> removal.
authorŁukasz Rekucki <lrekucki@gmail.com>
Mon, 15 Mar 2010 13:02:43 +0000 (14:02 +0100)
committerŁukasz Rekucki <lrekucki@gmail.com>
Mon, 15 Mar 2010 13:02:43 +0000 (14:02 +0100)
apps/wiki/views.py
platforma/settings.py
platforma/static/css/xmlcolors.css
platforma/static/js/xslt.js
requirements.txt

index dd3991f..df69373 100644 (file)
@@ -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:
index 628b4ef..a116a44 100644 (file)
@@ -171,10 +171,11 @@ INSTALLED_APPS = (
     'debug_toolbar',
     
     'compress',
-
-    'wiki',
+    'south',
     'sorl.thumbnail',
     'filebrowser',
+
+    'wiki',    
     'toolbar',
 )
 
index 1b60259..5a2d7cc 100644 (file)
@@ -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 {
index f5af909..566b0a8 100644 (file)
@@ -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';                                   
                                };
index 975ceb7..9c9509a 100644 (file)
@@ -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