User Tools

Site Tools


zopegeneral

General remarks to the usage of Zope

Unicode Problem mit Safari I

In allen Versionen von Zope gibt es Probleme mit der Darstellung von Umlauten in Safari. Es ist ein Fix in

    /lib/python/Products/PageTemplates/unicodeconflictresolver.py

notwendig. Die Fallbacklösung falls keine Kodierung erkannt wird sollte utf-8 sein und nicht die Standardkodierung von Python, die in der Regel ascii ist. Daher:

    #default_encoding = sys.getdefaultencoding()
    default_encoding = "utf-8"

Ausserdem wird im

    PreferredCharsetResolver

die Reihenfolge der Kodierungen die genutzt werden sollen, in der falschen Reihenfolge zusammengesetzt, daher besser den

    ReplacingUnicodeEncodingConflictResolver

benutzen. Dazu

    /lib/python/Products/PageTemplates/configure.zcml

entsprechend zu

    <configure xmlns="http://namespaces.zope.org/zope">
      <utility provides="Products.PageTemplates.interfaces.IUnicodeEncodingConflictResolver"
  component="Products.PageTemplates.unicodeconflictresolver.ReplacingUnicodeEncodingConflictResolver"
    />
 
     </configure>

abändern.

Unicode Problem mit Safari II

Ein anderer Fix besteht im ändern der Erkennung des accepted-charset (ich weiss nicht ob es die gleichen Fehler behebt wie oben, aber “it works for me”):

--- lib/python/zope/publisher/http.py.orig      2009-05-02 00:49:35.000000000 -0700
+++ lib/python/zope/publisher/http.py   2009-06-12 02:12:50.000000000 -0700
@@ -965,8 +965,11 @@
         # value of 1 if not explicitly mentioned.
         # And quoting RFC 2616, $14.2: "If no Accept-Charset header is
         # present, the default is that any character set is acceptable."
-        if not sawstar and not sawiso88591 and header_present:
+        # ROC: the following checked also for header_present which seemed wrong
+        if not sawstar and not sawiso88591:
             charsets.append((1.0, 'iso-8859-1'))
+            # ROC: if there is no header we assume star (to get utf-8)
+            sawstar = 1
         # UTF-8 is **always** preferred over anything else.
         # Reason: UTF-8 is not specific and can encode the entire unicode
         # range , unlike many other encodings. Since Zope can easily use very

Running Cronjobs with Zope

Zope kann so konfiguriert werden, dass regelmäßig eine Seite aufgerufen wird. Als Beispiel siehe https://itgroup.mpiwg-berlin.mpg.de:8080/tracs/webpage/wiki/zopeConf.

ZPsycopgDA and Zope 2.13

ZPsycopgDA assumes the existence of its icon in Shared/DC/ZRDB/www/DBAdapterFolder_icon.gif where it was removed. The icon should be put in ZPsycopgDA/icons and the following patch applied:

diff -ruBb ZPsycopgDA.orig/DA.py ZPsycopgDA/DA.py
--- ZPsycopgDA.orig/DA.py	2011-02-03 15:46:46.000000000 +0100
+++ ZPsycopgDA/DA.py	2011-02-03 15:43:11.000000000 +0100
@@ -194,7 +194,8 @@
 
 # add icons
 
-misc_={'conn': ImageFile('Shared/DC/ZRDB/www/DBAdapterFolder_icon.gif')}
+misc_={'conn': ImageFile('icons/DBAdapterFolder_icon.gif', globals())}
+#misc_={'conn': ImageFile('Shared/DC/ZRDB/www/DBAdapterFolder_icon.gif')}
 
 for icon in ('table', 'view', 'stable', 'what', 'field', 'text', 'bin',
              'int', 'float', 'date', 'time', 'datetime'):
diff -ruBb ZPsycopgDA.orig/__init__.py ZPsycopgDA/__init__.py
--- ZPsycopgDA.orig/__init__.py	2011-02-03 15:46:46.000000000 +0100
+++ ZPsycopgDA/__init__.py	2011-02-03 15:46:03.000000000 +0100
@@ -26,4 +26,4 @@
         permission = 'Add Z Psycopg 2 Database Connections',
         constructors = (DA.manage_addZPsycopgConnectionForm,
                         DA.manage_addZPsycopgConnection),
-        icon = SOFTWARE_HOME + '/Shared/DC/ZRDB/www/DBAdapterFolder_icon.gif')
+        icon = 'icons/DBAdapterFolder_icon.gif')
Only in ZPsycopgDA: __init__.py~
Only in ZPsycopgDA/icons: DBAdapterFolder_icon.gif

ExtFile 2.0.2 and Zope 2.13

ExtFile tries to import interfaces from zope.app.container where it does not exist anymore. This patch fixes it:

diff -uBbr Products/ExtFile/ExtFile.py Products.new/ExtFile/ExtFile.py
--- Products/ExtFile/ExtFile.py	2011-05-15 03:20:48.000000000 -0700
+++ Products.new/ExtFile/ExtFile.py	2011-05-09 07:36:19.000000000 -0700
@@ -1065,8 +1065,10 @@
 
         Subscriber for (IExtFile, IObjectMovedEvent)
     """
-    from zope.app.container.interfaces import IObjectAddedEvent
-    from zope.app.container.interfaces import IObjectRemovedEvent
+    #from zope.app.container.interfaces import IObjectAddedEvent
+    #from zope.app.container.interfaces import IObjectRemovedEvent
+    from zope.container.interfaces import IObjectAddedEvent
+    from zope.container.interfaces import IObjectRemovedEvent
 
     # If this is a Removed event we are done
     if IObjectRemovedEvent.providedBy(event):
diff -uBbr Products/ExtFile/ExtImage.py Products.new/ExtFile/ExtImage.py
--- Products/ExtFile/ExtImage.py	2011-05-15 03:20:48.000000000 -0700
+++ Products.new/ExtFile/ExtImage.py	2011-05-09 07:36:38.000000000 -0700
@@ -678,8 +678,10 @@
 
         Subscriber for (IExtImage, IObjectMovedEvent)
     """
-    from zope.app.container.interfaces import IObjectAddedEvent
-    from zope.app.container.interfaces import IObjectRemovedEvent
+    #from zope.app.container.interfaces import IObjectAddedEvent
+    #from zope.app.container.interfaces import IObjectRemovedEvent
+    from zope.container.interfaces import IObjectAddedEvent
+    from zope.container.interfaces import IObjectRemovedEvent
 
     # If this is a Removed event we are done
     if IObjectRemovedEvent.providedBy(event):
--- Products/ExtFile/configure.zcml	2011-05-15 03:20:48.000000000 -0700
+++ Products.new/ExtFile/configure.zcml	2011-04-28 07:44:30.000000000 -0700
@@ -5,7 +5,7 @@
   <subscriber
     handler=".ExtFile.afterAdd"
     for=".interfaces.IExtFile
-         zope.app.container.interfaces.IObjectMovedEvent"
+         zope.container.interfaces.IObjectMovedEvent"
     />
 
   <subscriber
@@ -23,7 +23,7 @@
   <subscriber
     handler=".ExtImage.afterAdd"
     for=".interfaces.IExtImage
-         zope.app.container.interfaces.IObjectMovedEvent"
+         zope.container.interfaces.IObjectMovedEvent"
     />
 
   <subscriber
zopegeneral.txt · Last modified: 2011/07/12 20:18 (external edit)