[Erp5-report] r12782 - in /spec/debian/unstable/erp5-ihotfix: ./ iHotfix/ iHotfix/debian/ i...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 15 18:27:30 CET 2007


Author: yusei
Date: Thu Feb 15 18:27:26 2007
New Revision: 12782

URL: http://svn.erp5.org?rev=12782&view=rev
Log:
added debian package and workspace.

Added:
    spec/debian/unstable/erp5-ihotfix/
    spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.diff.gz   (with props)
    spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.dsc
    spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_all.deb   (with props)
    spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.build
    spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.changes
    spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2.orig.tar.gz   (with props)
    spec/debian/unstable/erp5-ihotfix/iHotfix/
    spec/debian/unstable/erp5-ihotfix/iHotfix-0.5.2-get_request.patch
    spec/debian/unstable/erp5-ihotfix/iHotfix/CHANGES.txt
    spec/debian/unstable/erp5-ihotfix/iHotfix/Changelog
    spec/debian/unstable/erp5-ihotfix/iHotfix/README.txt
    spec/debian/unstable/erp5-ihotfix/iHotfix/TODO.txt
    spec/debian/unstable/erp5-ihotfix/iHotfix/__init__.py
    spec/debian/unstable/erp5-ihotfix/iHotfix/build-stamp
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/changelog
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/compat
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/control
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/copyright
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/dzproduct
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patched/
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patched/01_iHotfix-0.5.2-get_request.dpatch
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/00list
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/01_iHotfix-0.5.2-get_request.dpatch   (with props)
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/postinst
    spec/debian/unstable/erp5-ihotfix/iHotfix/debian/rules   (with props)
    spec/debian/unstable/erp5-ihotfix/iHotfix/patch-stamp
    spec/debian/unstable/erp5-ihotfix/iHotfix/version.txt

Added: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.diff.gz
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.diff.gz?rev=12782&view=auto
==============================================================================
Binary file - no diff available.

Propchange: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.diff.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.dsc
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.dsc?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.dsc (added)
+++ spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1.dsc Thu Feb 15 18:27:26 2007
@@ -1,0 +1,12 @@
+Format: 1.0
+Source: erp5-ihotfix
+Version: 0.5.2-1
+Binary: erp5-ihotfix
+Maintainer: Yusei TAHARA
+Architecture: all
+Standards-Version: 3.7.2
+Build-Depends: debhelper (>= 5.0)
+Build-Depends-Indep: zope-debhelper (>= 0.3.6)
+Files: 
+ de20325472328e4ebeecdf88e59977ad 6731 erp5-ihotfix_0.5.2.orig.tar.gz
+ 9cbfc6dee2e85a865c1f3910afb9782a 1620 erp5-ihotfix_0.5.2-1.diff.gz

Added: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_all.deb
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_all.deb?rev=12782&view=auto
==============================================================================
Binary file - no diff available.

Propchange: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_all.deb
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.build
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.build?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.build (added)
+++ spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.build Thu Feb 15 18:27:26 2007
@@ -1,0 +1,40 @@
+ fakeroot debian/rules clean
+dh_testdir
+dh_testroot
+rm -f build-stamp configure-stamp
+dh_clean
+ dpkg-source -b iHotfix
+dpkg-source: warning: source directory `./iHotfix' is not <sourcepackage>-<upstreamversion> `erp5-ihotfix-0.5.2'
+dpkg-source: warning: .orig directory name iHotfix.orig is not <package>-<upstreamversion> (wanted erp5-ihotfix-0.5.2.orig)
+dpkg-source: building erp5-ihotfix using existing erp5-ihotfix_0.5.2.orig.tar.gz
+dpkg-source: building erp5-ihotfix in erp5-ihotfix_0.5.2-1.diff.gz
+dpkg-source: warning: executable mode 0755 of `debian/patches/01_iHotfix-0.5.2-get_request.dpatch' will not be represented in diff
+dpkg-source: building erp5-ihotfix in erp5-ihotfix_0.5.2-1.dsc
+ debian/rules build
+test -d debian/patched || install -d debian/patched
+dpatch  apply-all  
+applying patch 01_iHotfix-0.5.2-get_request to ./ ... ok.
+dpatch  cat-all  >>patch-stampT
+mv -f patch-stampT patch-stamp
+touch build-stamp
+ fakeroot debian/rules binary
+dh_testdir
+dh_testroot
+dh_clean -k
+dh_installdirs
+dh_installerp5zope .
+dh_testdir
+dh_testroot
+dh_installdocs
+dh_installexamples
+dh_installchangelogs
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
+dpkg-deb: `../erp5-ihotfix_0.5.2-1_all.deb' ¤Ë¥Ñ¥Ã¥±¡¼¥¸ `erp5-ihotfix' ¤ò¹½ÃÛ¤·¤Æ¤¤¤Þ¤¹¡£
+ dpkg-genchanges
+dpkg-genchanges: including full source code in upload
+dpkg-buildpackage (debuild emulation): full upload (original source is included)

Added: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.changes
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.changes?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.changes (added)
+++ spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2-1_i386.changes Thu Feb 15 18:27:26 2007
@@ -1,0 +1,21 @@
+Format: 1.7
+Date: Wed, 14 Feb 2007 03:27:56 +0900
+Source: erp5-ihotfix
+Binary: erp5-ihotfix
+Architecture: source all
+Version: 0.5.2-1
+Distribution: unstable
+Urgency: low
+Maintainer: Yusei TAHARA
+Changed-By: Yusei TAHARA <yusei at domen.cx>
+Description: 
+ erp5-ihotfix - Localizer's dynamic patch for Zope
+Changes: 
+ erp5-ihotfix (0.5.2-1) unstable; urgency=low
+ .
+   * Initial Release.
+Files: 
+ 3c2cda388a785fadc696d47132093d00 366 web optional erp5-ihotfix_0.5.2-1.dsc
+ de20325472328e4ebeecdf88e59977ad 6731 web optional erp5-ihotfix_0.5.2.orig.tar.gz
+ 9cbfc6dee2e85a865c1f3910afb9782a 1620 web optional erp5-ihotfix_0.5.2-1.diff.gz
+ ddb11fc9036b48f5024f0c90c71d8b8b 8782 web optional erp5-ihotfix_0.5.2-1_all.deb

Added: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2.orig.tar.gz
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2.orig.tar.gz?rev=12782&view=auto
==============================================================================
Binary file - no diff available.

Propchange: spec/debian/unstable/erp5-ihotfix/erp5-ihotfix_0.5.2.orig.tar.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: spec/debian/unstable/erp5-ihotfix/iHotfix-0.5.2-get_request.patch
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix-0.5.2-get_request.patch?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix-0.5.2-get_request.patch (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix-0.5.2-get_request.patch Thu Feb 15 18:27:26 2007
@@ -1,0 +1,14 @@
+--- iHotfix-0.5.2.orig/iHotfix/__init__.py 2005-03-13 21:05:34.000000000 +0100
++++ iHotfix-0.5.2/iHotfix/__init__.py 2005-04-26 21:54:49.460730367 +0200
+@@ -115,7 +115,10 @@
+ 
+     # Add get_request for backwards compatibility
+     def get_request():
+-        return get_context().request.zope_request
++        try:
++            return get_context().request.zope_request
++        except:
++            return None
+     Globals.get_request = get_request
+ 
+ 

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/CHANGES.txt
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/CHANGES.txt?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/CHANGES.txt (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/CHANGES.txt Thu Feb 15 18:27:26 2007
@@ -1,0 +1,4 @@
+0.5.2 (2005/03/13)
+
+  Bugs fixed
+  - Get it working with Plone again.

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/Changelog
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/Changelog?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/Changelog (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/Changelog Thu Feb 15 18:27:26 2007
@@ -1,0 +1,125 @@
+# do not edit -- automatically generated by arch changelog
+# arch-tag: automatic-ChangeLog--jdavid at itaapy.com--public/iHotfix--main--0.5
+#
+
+2005-03-13 20:05:15 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-8
+
+    Summary:
+      get ready to release 0.5.2
+    Revision:
+      iHotfix--main--0.5--patch-8
+
+
+    new files:
+     .arch-ids/CHANGES.txt.id .arch-ids/Changelog.id CHANGES.txt
+     Changelog
+
+    removed files:
+     .arch-ids/Changelog.id Changelog
+
+    modified files:
+     version.txt
+
+
+2005-01-21 11:07:44 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-7
+
+    Summary:
+      get it working with Plone
+    Revision:
+      iHotfix--main--0.5--patch-7
+
+
+    modified files:
+     __init__.py
+
+
+2005-01-11 17:19:52 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-6
+
+    Summary:
+      update changelog
+    Revision:
+      iHotfix--main--0.5--patch-6
+
+
+    modified files:
+     Changelog
+
+
+2005-01-11 16:43:41 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-5
+
+    Summary:
+      get ready to release 0.5.1
+    Revision:
+      iHotfix--main--0.5--patch-5
+
+
+    modified files:
+     version.txt
+
+
+2005-01-10 13:14:11 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-4
+
+    Summary:
+      make the global request patch thread safe, thanks to Marco Bizzarri
+    Revision:
+      iHotfix--main--0.5--patch-4
+
+
+    modified files:
+     __init__.py
+
+
+2004-11-27 19:16:51 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-3
+
+    Summary:
+      update changelog
+    Revision:
+      iHotfix--main--0.5--patch-3
+
+    Update changelog.
+
+    modified files:
+     Changelog
+
+
+2004-11-27 19:14:40 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-2
+
+    Summary:
+      get ready to release 0.5
+    Revision:
+      iHotfix--main--0.5--patch-2
+
+    Get ready to release 0.5.
+
+    modified files:
+     README.txt __init__.py version.txt
+
+
+2004-11-22 18:26:34 GMT	J. David Ibanez <jdavid at itaapy.com>	patch-1
+
+    Summary:
+      move the Localizer.Gettext code to iHotfix
+    Revision:
+      iHotfix--main--0.5--patch-1
+
+    Move the Localizer.Gettext code to iHotfix. This removes the last
+    depedency of iKaaro to Localizer.
+
+    modified files:
+     __init__.py
+
+
+2004-11-22 18:24:09 GMT	J. David Ibanez <jdavid at itaapy.com>	base-0
+
+    Summary:
+      tag of jdavid at itaapy.com--public/iHotfix--main--0.4--patch-1
+    Revision:
+      iHotfix--main--0.5--base-0
+
+    (automatically generated log message)
+
+    new patches:
+     jdavid at itaapy.com--public/iHotfix--main--0.4--base-0
+     jdavid at itaapy.com--public/iHotfix--main--0.4--patch-1
+
+

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/README.txt
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/README.txt?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/README.txt (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/README.txt Thu Feb 15 18:27:26 2007
@@ -1,0 +1,118 @@
+
+This product dynamically patches Zope to fix four problems: the global
+request, the accept language, unicode for ZPT and mx.DateTime. Details
+below.
+
+
+Installation
+============
+
+This product requires the itools Python package. Download the last version
+from http://sf.net/projects/lleu
+
+Then just unpack the tarball in the 'Products' directory.
+
+
+1. Global Request
+=================
+
+It makes the request and response objects globally available through the
+"context".
+
+    >>> from itools.zope import get_context
+    >>> context = get_context()
+    >>> request, response = context.request, context.response
+
+In some situations (within the __getattr__ and __of__ methods, for instance)
+this is the only way to get the request and response objects. It is also more
+elegant than to pass them as parameters to to get them through acquisition.
+
+This method is thread safe.
+
+
+2. Accept Language
+==================
+
+Adds the variables AcceptLanguage and AcceptCharset to the request object.
+They provide a higher level interface than HTTP_ACCEPT_LANGUAGE and
+HTTP_ACCEPT_CHARSET.
+
+
+3. Unicode for ZPT
+==================
+
+Fixes Zope to enable the use of Unicode with Page Templates.
+
+
+4. mx.DateTime
+==============
+
+Helps to use the DateTime module developed by Marc-Andre Lemburg from
+restricted code. In particular what it:
+
+  - Allows instances of the 'DateTime' class to be used from restricted code;
+
+  - Allows to use the 'DateTime' module from restricted code;
+
+  - Puts the 'DateTime' module in the DTML namespace with the 'mxDateTime'
+    name.
+
+For example, this lets to use:
+
+   <dtml-var "_.mxDateTime.today()">
+
+Of course, for this to work you neet to install mx.DateTime first, see:
+
+  http://www.lemburg.com/files/python/mxDateTime.html
+
+
+5. locale
+=========
+
+Multilingual products need a place to store the message catalogs, both
+Localizer and iKaaro use the convention to store them within the product,
+in the 'locale' directory, for example:
+
+  locale/en.po
+  locale/es.po
+  locale/fr.po
+
+It is iHotfix which provides the means to access the catalogs this way. Use
+it in your own product like:
+
+  from Products.iHotfix import N_, translation
+  _ = translation(globals())
+
+Put the two lines above in your product to get the functions '_' and 'N_',
+the developer familiarized with gettext will recognize them. What they do
+is:
+
+  _(message, language=None)
+  Looks up a translation for the message in the message catalog and returns
+  it if it exists, otherwise returns the message. The parameter 'language'
+  says which catalog to use, if it is 'None', the language negotiation
+  machinery will be triggered to choose one.
+
+  N_(message, language=None)
+  Always returns the message itself. This function is used to markup a message
+  so the extraction scripts detect it to feed the message catalogs.
+
+
+Author and License
+==================
+
+  Copyright (C) 2001-2004  Juan David Ibáñez Palomar (jdavid at itaapy.com)
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License
+  as published by the Free Software Foundation; either version 2
+  of the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/TODO.txt
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/TODO.txt?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/TODO.txt (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/TODO.txt Thu Feb 15 18:27:26 2007
@@ -1,0 +1,1 @@
+* Change the license to ZPL 2.1

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/__init__.py
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/__init__.py?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/__init__.py (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/__init__.py Thu Feb 15 18:27:26 2007
@@ -1,0 +1,413 @@
+# -*- coding: ISO-8859-1 -*-
+# Copyright (C) 2000-2004  Juan David Ibáñez Palomar <jdavid at itaapy.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+"""
+This Zope product is a hotfix, it dynamically applies several patches
+to Zope.
+"""
+
+
+# Import from Python
+from gettext import GNUTranslations
+import os
+import pprint
+from StringIO import StringIO as originalStringIO
+from thread import get_ident, allocate_lock
+from types import UnicodeType
+
+# Import from itools
+from itools import get_abspath
+from itools.i18n.accept import AcceptCharset, AcceptLanguage
+from itools.zope.Context import Context
+from itools.zope import get_context
+
+# Import Zope modules
+import Globals
+from Products.PageTemplates.PageTemplate import getEngine, PageTemplate, \
+     PTRuntimeError
+from Products.PageTemplates import TALES
+from TAL.TALInterpreter import TALInterpreter
+from zLOG import LOG, ERROR, INFO, PROBLEM, DEBUG
+from ZPublisher import Publish, mapply
+from ZPublisher.HTTPRequest import HTTPRequest
+
+
+# Flag
+patch = False
+Z_DEBUG_MODE = os.environ.get('Z_DEBUG_MODE') == '1'
+
+# PATCH 1: Global Request
+#
+# The original purpose was to get the request object from places where the
+# acquisition was disabled (within the __of__ method for example). It was
+# inspired by the Tim McLaughlin's GlobalGetRequest proposal, see
+# http://dev.zope.org/Wikis/DevSite/Proposals/GlobalGetRequest
+#
+# Currently it keeps a Context instance, which wraps the request object,
+# but also other things, like the user's session, as it is required by
+# the ikaaro CMS.
+#
+# The context objects are stored in a dictionary in the Publish module,
+# whose keys are the thread id.
+#
+# Also, we keep the get_request method in the Globals module for backwards
+# compatibility (with TranslationService for example).
+
+contexts = {}
+_the_lock = allocate_lock()
+
+
+def new_publish(zope_request, module_name, after_list, debug=0):
+    # Build the Context instance, a wrapper around the Zope request
+    context = Context(zope_request)
+    # Store it
+    id = get_ident()
+    _the_lock.acquire()
+    try:
+        contexts[id] = context
+    finally:
+        _the_lock.release()
+
+    try:
+        # Publish
+        x = Publish.zope_publish(zope_request, module_name, after_list, debug)
+    finally:
+        # Remove the context object.
+        # When conflicts occur the "publish" method is called again,
+        # recursively. In this situation the context dictionary would
+        # be cleaned in the innermost call, hence outer calls find the
+        # context does not exists anymore. For this reason we check first
+        # wether the context is there or not.
+        if id in contexts:
+            _the_lock.acquire()
+            try:
+                del contexts[id]
+            finally:
+                _the_lock.release()
+
+    return x
+
+
+if patch is False:
+    # XXX What happens when Localizer 1.0 and iHotfix are installed??
+    # Apply the patch
+    Publish.zope_publish = Publish.publish
+    Publish.publish = new_publish
+
+    # First import (it's not a refresh operation).
+    # We need to apply the patches.
+    patch = True
+
+    # Add get_request for backwards compatibility
+    def get_request():
+        try:
+            return get_context().request.zope_request
+        except:
+            return None
+    Globals.get_request = get_request
+
+
+
+# PATCH 2: Accept
+#
+# Adds the variables AcceptLanguage and AcceptCharset to the REQUEST.
+# They provide a higher level interface than HTTP_ACCEPT_LANGUAGE and
+# HTTP_ACCEPT_CHARSET.
+
+# Apply the patch
+def new_processInputs(self):
+    HTTPRequest.old_processInputs(self)
+
+    request = self
+
+    # Set the AcceptCharset variable
+    accept = request['HTTP_ACCEPT_CHARSET']
+    self.other['AcceptCharset'] = AcceptCharset(request['HTTP_ACCEPT_CHARSET'])
+
+    # Set the AcceptLanguage variable
+    # Initialize with the browser configuration
+    accept_language = request['HTTP_ACCEPT_LANGUAGE']
+    # Patches for user agents that don't support correctly the protocol
+    user_agent = request['HTTP_USER_AGENT']
+    if user_agent.startswith('Mozilla/4') and user_agent.find('MSIE') == -1:
+        # Netscape 4.x
+        q = 1.0
+        langs = []
+        for lang in [ x.strip() for x in accept_language.split(',') ]:
+            langs.append('%s;q=%f' % (lang, q))
+            q = q/2
+        accept_language = ','.join(langs)
+
+    accept_language = AcceptLanguage(accept_language)
+
+    self.other['AcceptLanguage'] = accept_language
+    # XXX For backwards compatibility
+    self.other['USER_PREF_LANGUAGES'] = accept_language
+
+
+if patch:
+##    from ZPublisher.BaseRequest import BaseRequest
+##    from itools.zope.request import iRequest
+
+##    HTTPRequest.__bases__ = (iRequest, BaseRequest)
+
+    HTTPRequest.old_processInputs = HTTPRequest.processInputs
+    HTTPRequest.processInputs = new_processInputs
+
+
+
+# PATCH 3: Unicode
+#
+# Enables support of Unicode in ZPT.
+# For Zope 2.5.1 (unsupported), patch appropriately.
+# For Zope 2.6b1+
+#   - if LOCALIZER_USE_ZOPE_UNICODE, use standard Zope Unicode handling,
+#   - otherwise use iHotfix's version of StringIO for ZPT and TAL.
+
+patch_251 = not hasattr(TALInterpreter, 'StringIO')
+
+if patch_251:
+    try:
+        # Patched 2.5.1 should have ustr in __builtins__
+        ustr
+    except NameError:
+        LOG('iHotfix', PROBLEM,
+            'A Unicode-aware version of Zope is needed by iHotfix to'
+            ' apply its Unicode patch. Please consult the documentation'
+            ' for a patched version of Zope 2.5.1, or use Zope 2.6b1 or'
+            ' later.')
+    else:
+        # 3.1 - Fix two instances where ustr must be used
+        def evaluateText(self, expr):
+            text = self.evaluate(expr)
+            if text is TALES.Default or text is None:
+                return text
+            return ustr(text) # Use "ustr" instead of "str"
+        TALES.Context.evaluateText = evaluateText
+
+        def do_insertStructure_tal(self, (expr, repldict, block)):
+            structure = self.engine.evaluateStructure(expr)
+            if structure is None:
+                return
+            if structure is self.Default:
+                self.interpret(block)
+                return
+            text = ustr(structure)  # Use "ustr" instead of "str"
+            if not (repldict or self.strictinsert):
+                # Take a shortcut, no error checking
+                self.stream_write(text)
+                return
+            if self.html:
+                self.insertHTMLStructure(text, repldict)
+            else:
+                self.insertXMLStructure(text, repldict)
+        TALInterpreter.do_insertStructure_tal = do_insertStructure_tal
+        TALInterpreter.bytecode_handlers_tal["insertStructure"] = do_insertStructure_tal
+
+
+# 3.2 - Fix uses of StringIO with a Unicode-aware StringIO
+
+class iHotfixStringIO(originalStringIO):
+    def write(self, s):
+        if isinstance(s, UnicodeType):
+            response = get_request().RESPONSE
+            try:
+                s = response._encode_unicode(s)
+            except AttributeError:
+                # not an HTTPResponse
+                pass
+        originalStringIO.write(self, s)
+
+
+if not patch_251:
+    if os.environ.get('LOCALIZER_USE_ZOPE_UNICODE'):
+        LOG('iHotfix', DEBUG, 'No Unicode patching')
+        # Use the standard Zope way of dealing with Unicode
+    else:
+        LOG('iHotfix', DEBUG, 'Unicode patching for Zope 2.6b1+')
+        # Patch the StringIO method of TALInterpreter and PageTemplate
+        def patchedStringIO(self):
+            return iHotfixStringIO()
+        TALInterpreter.StringIO = patchedStringIO
+        PageTemplate.StringIO = patchedStringIO
+
+else:
+    LOG('iHotfix', DEBUG, 'Unicode patching for Zope 2.5.1')
+    # Patch uses of StringIO in Zope 2.5.1
+    def no_tag(self, start, program):
+        state = self.saveState()
+        self.stream = stream = iHotfixStringIO()
+        self._stream_write = stream.write
+        self.interpret(start)
+        self.restoreOutputState(state)
+        self.interpret(program)
+    TALInterpreter.no_tag = no_tag
+
+    def do_onError_tal(self, (block, handler)):
+        state = self.saveState()
+        self.stream = stream = iHotfixStringIO()
+        self._stream_write = stream.write
+        try:
+            self.interpret(block)
+        except self.TALESError, err:
+            self.restoreState(state)
+            engine = self.engine
+            engine.beginScope()
+            err.lineno, err.offset = self.position
+            engine.setLocal('error', err)
+            try:
+                self.interpret(handler)
+            finally:
+                err.takeTraceback()
+                engine.endScope()
+        else:
+            self.restoreOutputState(state)
+            self.stream_write(stream.getvalue())
+    TALInterpreter.do_onError_tal = do_onError_tal
+
+    def pt_render(self, source=0, extra_context={}):
+        """Render this Page Template"""
+        if self._v_errors:
+            raise PTRuntimeError, 'Page Template %s has errors.' % self.id
+        output = iHotfixStringIO()
+        c = self.pt_getContext()
+        c.update(extra_context)
+        if Z_DEBUG_MODE:
+            __traceback_info__ = pprint.pformat(c)
+
+        TALInterpreter(self._v_program, self._v_macros,
+                       getEngine().getContext(c),
+                       output,
+                       tal=not source, strictinsert=0)()
+        return output.getvalue()
+    PageTemplate.pt_render = pt_render
+
+del patch_251
+
+
+
+# PATCH 4: mxDateTime
+#
+# Help to use the mx.DateTime Python module from restricted code.
+
+try:
+    from mx import DateTime
+except ImportError:
+    pass
+else:
+    # Define a helper method that should be provided by Zope
+    from AccessControl.SimpleObjectPolicies import ContainerAssertions
+    def allow_type(ob):
+        """
+        Allows a simple object to be used from restricted code.
+        """
+        ContainerAssertions[type(ob)] = 1
+
+
+    # Allow access to DateTime instances from restricted code
+    allow_type(DateTime.today())
+
+    # XXX Remains to let access to other object types (DateTimeDelta, etc.)
+
+    # Allow access to the DateTime module
+    DateTime.__allow_access_to_unprotected_subobjects__ = 1
+
+    # Puts the mxDateTime module in the '_' variable
+    # XXX Perhaps we should put the whole mx module.
+    from DocumentTemplate.cDocumentTemplate import TemplateDict
+    TemplateDict.__dict__['mxDateTime'] = DateTime
+
+
+
+# PATCH 5: locale
+#
+# Actually, this is not a patch. It provides an API to access translations
+# stored as MO files in the 'locale' directory. This code has been moved
+# from Localizer.
+
+# {<locale directory>: {<language code>: <GNUTranslations instance>}}
+translations = {}
+
+def get_translations(localedir, language=None):
+    """
+    Looks the <language>.mo file in <localedir> and returns a
+    GNUTranslations instance for it. If <language> is None uses
+    the language negotiator to guess the user preferred language.
+    """
+    # Initialize the product translations
+    locale = localedir
+    if not translations.has_key(locale):
+        translations[locale] = None
+
+    if translations[locale] is None:
+        translations[locale] = {}
+        # Load .mo files
+        for filename in [ x for x in os.listdir(locale) if x.endswith('.mo') ]:
+            lang = filename[:-3]
+            filename = os.path.join(locale, filename)
+            f = open(filename, 'rb')
+            translations[locale][lang] = GNUTranslations(f)
+            f.close()
+
+    # Get the translations to use
+    ptranslations = translations[locale]
+
+    if language is None:
+        context = get_context()
+        # Build the list of available languages
+        available_languages = ptranslations.keys()
+        # Get the language!
+        accept = context.request.accept_language
+        lang = accept.select_language(available_languages)
+    else:
+        lang = None
+
+    return ptranslations.get(lang or language, None)
+
+
+
+def gettext(self, message, language=None):
+    """ """
+    # Get the translations to use
+    translations = get_translations(self.locale, language)
+
+    if translations is not None:
+        return translations.ugettext(message)
+
+    return message
+
+
+
+class translation:
+    def __init__(self, namespace):
+        self.locale = get_abspath(namespace, 'locale/')
+
+    __call__ = gettext
+
+
+
+def N_(message, language=None):
+    """
+    Used to markup a string for translation but without translating it,
+    this is known as deferred translations.
+    """
+    return message
+
+
+# XXX For backwards compatibility.
+dummy = N_

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/build-stamp
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/build-stamp?rev=12782&view=auto
==============================================================================
    (empty)

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/changelog
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/changelog?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/changelog (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/changelog Thu Feb 15 18:27:26 2007
@@ -1,0 +1,6 @@
+erp5-ihotfix (0.5.2-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Yusei TAHARA <yusei at domen.cx>  Wed, 14 Feb 2007 03:27:56 +0900
+

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/compat
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/compat?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/compat (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/compat Thu Feb 15 18:27:26 2007
@@ -1,0 +1,1 @@
+5

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/control
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/control?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/control (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/control Thu Feb 15 18:27:26 2007
@@ -1,0 +1,14 @@
+Source: erp5-ihotfix
+Section: web
+Priority: optional
+Maintainer: Yusei TAHARA
+Build-Depends: debhelper (>= 5.0)
+Build-Depends-Indep: zope-debhelper (>= 0.3.6)
+Standards-Version: 3.7.2
+
+Package: erp5-ihotfix
+Architecture: all
+Depends: erp5-zope
+Description: Localizer's dynamic patch for Zope
+ This product dynamically patches Zope to fix four problems: the global
+ request, the accept language, unicode for ZPT and mx.DateTime.

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/copyright
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/copyright?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/copyright (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/copyright Thu Feb 15 18:27:26 2007
@@ -1,0 +1,15 @@
+  Copyright (C) 2001-2004  Juan David Ibáñez Palomar (jdavid at itaapy.com)
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License
+  as published by the Free Software Foundation; either version 2
+  of the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/dzproduct
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/dzproduct?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/dzproduct (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/dzproduct Thu Feb 15 18:27:26 2007
@@ -1,0 +1,3 @@
+Name: iHotfix
+Package: erp5-ihotfix
+ZopeVersions: >= 2.7

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patched/01_iHotfix-0.5.2-get_request.dpatch
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patched/01_iHotfix-0.5.2-get_request.dpatch?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patched/01_iHotfix-0.5.2-get_request.dpatch (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patched/01_iHotfix-0.5.2-get_request.dpatch Thu Feb 15 18:27:26 2007
@@ -1,0 +1,1 @@
+patching file __init__.py

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/00list
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/00list?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/00list (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/00list Thu Feb 15 18:27:26 2007
@@ -1,0 +1,1 @@
+01_iHotfix-0.5.2-get_request.dpatch

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/01_iHotfix-0.5.2-get_request.dpatch
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/01_iHotfix-0.5.2-get_request.dpatch?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/01_iHotfix-0.5.2-get_request.dpatch (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/01_iHotfix-0.5.2-get_request.dpatch Thu Feb 15 18:27:26 2007
@@ -1,0 +1,18 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+ at DPATCH@
+
+--- iHotfix-0.5.2.orig/__init__.py 2005-03-13 21:05:34.000000000 +0100
++++ iHotfix-0.5.2/__init__.py 2005-04-26 21:54:49.460730367 +0200
+@@ -115,7 +115,10 @@
+ 
+     # Add get_request for backwards compatibility
+     def get_request():
+-        return get_context().request.zope_request
++        try:
++            return get_context().request.zope_request
++        except:
++            return None
+     Globals.get_request = get_request
+ 
+ 

Propchange: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/patches/01_iHotfix-0.5.2-get_request.dpatch
------------------------------------------------------------------------------
    svn:executable = 

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/postinst
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/postinst?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/postinst (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/postinst Thu Feb 15 18:27:26 2007
@@ -1,0 +1,7 @@
+#!/bin/sh -e
+
+. /usr/share/debconf/confmodule
+
+#DEBHELPER#
+
+db_stop

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/rules
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/debian/rules?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/debian/rules (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/debian/rules Thu Feb 15 18:27:26 2007
@@ -1,0 +1,46 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+include /usr/share/dpatch/dpatch.make
+
+pwd        := $(shell pwd)
+debian     := $(pwd)/debian/erp5-ihotfix
+
+build: patch-stamp build-stamp
+build-stamp:
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+	dh_installerp5zope .
+
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples
+	dh_installchangelogs
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary-arch:
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary install

Propchange: spec/debian/unstable/erp5-ihotfix/iHotfix/debian/rules
------------------------------------------------------------------------------
    svn:executable = 

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/patch-stamp
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/patch-stamp?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/patch-stamp (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/patch-stamp Thu Feb 15 18:27:26 2007
@@ -1,0 +1,4 @@
+Patches applied in the Debian version of :
+
+debian/patches/01_iHotfix-0.5.2-get_request.dpatch ():
+

Added: spec/debian/unstable/erp5-ihotfix/iHotfix/version.txt
URL: http://svn.erp5.org/spec/debian/unstable/erp5-ihotfix/iHotfix/version.txt?rev=12782&view=auto
==============================================================================
--- spec/debian/unstable/erp5-ihotfix/iHotfix/version.txt (added)
+++ spec/debian/unstable/erp5-ihotfix/iHotfix/version.txt Thu Feb 15 18:27:26 2007
@@ -1,0 +1,1 @@
+iHotfix 0.5.2




More information about the Erp5-report mailing list