# HG changeset patch # User paulb # Date 1131979300 0 # Node ID c1e3e05d2ce4f8789fec2d5ca368e4f613914aa7 # Parent 5ce6507fa71f637e3be204e152f6d8c7d11d2c41 [project @ 2005-11-14 14:41:27 by paulb] Added filesystem encoding workaround. diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/BaseHTTPRequestHandler/CalendarApp.py --- a/examples/BaseHTTPRequestHandler/CalendarApp.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/BaseHTTPRequestHandler/CalendarApp.py Mon Nov 14 14:41:40 2005 +0000 @@ -4,6 +4,10 @@ from Calendar import CalendarResource print "Serving..." + +# Choose or customise one of the following if the example fails. + deploy(CalendarResource()) +#deploy(CalendarResource("iso-8859-1")) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/CGI/CalendarHandler.py --- a/examples/CGI/CalendarHandler.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/CGI/CalendarHandler.py Mon Nov 14 14:41:40 2005 +0000 @@ -9,6 +9,9 @@ from WebStack.Adapters.CGI import deploy from Calendar import CalendarResource +# Choose or customise one of the following if the example fails. + deploy(CalendarResource()) +#deploy(CalendarResource("iso-8859-1")) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/Common/Calendar/__init__.py --- a/examples/Common/Calendar/__init__.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/Common/Calendar/__init__.py Mon Nov 14 14:41:40 2005 +0000 @@ -18,7 +18,7 @@ resource_dir = os.path.join(os.path.split(__file__)[0], "calendars") encoding = "utf-8" - def __init__(self): + def __init__(self, fsencoding=None): if not os.path.exists(self.resource_dir): try: os.mkdir(self.resource_dir) @@ -27,11 +27,19 @@ if not os.path.exists(self.resource_dir): os.mkdir(self.resource_dir) - if os.path.supports_unicode_filenames: - self.fsencoding = None + # Guess the filesystem encoding. + + if fsencoding is None: + if os.path.supports_unicode_filenames: + self.fsencoding = None + else: + import locale + self.fsencoding = locale.getdefaultlocale()[1] + + # Or override any guesses. + else: - import locale - self.fsencoding = locale.getdefaultlocale()[1] + self.fsencoding = fsencoding def _convert_name(self, name): if self.fsencoding: diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/JavaServlet/CalendarApp.py --- a/examples/JavaServlet/CalendarApp.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/JavaServlet/CalendarApp.py Mon Nov 14 14:41:40 2005 +0000 @@ -7,7 +7,11 @@ class CalendarApp(HttpServlet): def __init__(self): HttpServlet.__init__(self) + + # Choose or customise one of the following if the example fails. + self.dispatcher = JavaServlet.Dispatcher(CalendarResource()) + #self.dispatcher = JavaServlet.Dispatcher(CalendarResource("iso-8859-1")) def service(self, request, response): self.dispatcher.service(request, response) diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/ModPython/CalendarApp/CalendarHandler.py --- a/examples/ModPython/CalendarApp/CalendarHandler.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/ModPython/CalendarApp/CalendarHandler.py Mon Nov 14 14:41:40 2005 +0000 @@ -10,8 +10,10 @@ from Calendar import CalendarResource # NOTE: Not sure if the resource should be maintained in a resource pool. +# Choose or customise one of the following if the example fails. resource = CalendarResource() +#resource = CalendarResource("iso-8859-1") def handler(req): global resource diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/Twisted/CalendarApp.py --- a/examples/Twisted/CalendarApp.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/Twisted/CalendarApp.py Mon Nov 14 14:41:40 2005 +0000 @@ -4,6 +4,10 @@ from Calendar import CalendarResource print "Serving..." + +# Choose or customise one of the following if the example fails. + deploy(CalendarResource()) +#deploy(CalendarResource("iso-8859-1")) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/WSGI/CalendarHandler.py --- a/examples/WSGI/CalendarHandler.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/WSGI/CalendarHandler.py Mon Nov 14 14:41:40 2005 +0000 @@ -9,6 +9,9 @@ from WebStack.Adapters.WSGI import deploy from Calendar import CalendarResource +# Choose or customise one of the following if the example fails. + deploy(CalendarResource()) +#deploy(CalendarResource("iso-8859-1")) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/Webware/CalendarApp/__init__.py --- a/examples/Webware/CalendarApp/__init__.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/Webware/CalendarApp/__init__.py Mon Nov 14 14:41:40 2005 +0000 @@ -10,8 +10,10 @@ from Calendar import CalendarResource # NOTE: Initialising a shared resource. +# Choose or customise one of the following if the example fails. resource = CalendarResource() +#resource = CalendarResource("iso-8859-1") def InstallInWebKit(appServer): global resource diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/Webware/CalendarContext/__init__.py --- a/examples/Webware/CalendarContext/__init__.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/Webware/CalendarContext/__init__.py Mon Nov 14 14:41:40 2005 +0000 @@ -8,8 +8,11 @@ from Calendar import CalendarResource # NOTE: Initialising a shared resource. +# Choose or customise one of the following if the example fails. resource = CalendarResource() +#resource = CalendarResource("iso-8859-1") + urlParser = WebStackURLParser(resource) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 5ce6507fa71f -r c1e3e05d2ce4 examples/Zope/CalendarProduct/__init__.py --- a/examples/Zope/CalendarProduct/__init__.py Mon Nov 14 14:41:14 2005 +0000 +++ b/examples/Zope/CalendarProduct/__init__.py Mon Nov 14 14:41:40 2005 +0000 @@ -9,7 +9,11 @@ class CalendarProduct(WebStackAdapterProduct): meta_type = "Calendar product" def __init__(self, id): + + # Choose or customise one of the following if the example fails. + WebStackAdapterProduct.__init__(self, id, CalendarResource()) + #WebStackAdapterProduct.__init__(self, id, CalendarResource("iso-8859-1")) InitializeClass(CalendarProduct)