diff options
author | Jens Vagelpohl <jens@dataflake.org> | 2009-06-23 10:41:32 +0000 |
---|---|---|
committer | Jens Vagelpohl <jens@dataflake.org> | 2009-06-23 10:41:32 +0000 |
commit | bce8fbdcd2489290a424c6ab5f592602806434ad (patch) | |
tree | 58d739f205c51ee587423bf47ffa69e9b1f92709 /Products/JRedirector | |
parent | d2f411fc73c0cdf8874c95f7d2171ec9e99997c2 (diff) | |
download | Products.JRedirector-bce8fbdcd2489290a424c6ab5f592602806434ad.tar.gz Products.JRedirector-bce8fbdcd2489290a424c6ab5f592602806434ad.zip |
- modernization checkpoint
git-svn-id: file:///svn-public/Products.JRedirector/trunk@1809 835909ba-7c00-0410-bfa4-884f43845301
Diffstat (limited to 'Products/JRedirector')
-rw-r--r-- | Products/JRedirector/CHANGES.txt | 156 | ||||
-rw-r--r-- | Products/JRedirector/COPYRIGHT.txt | 9 | ||||
-rw-r--r-- | Products/JRedirector/INSTALL.txt | 16 | ||||
-rw-r--r-- | Products/JRedirector/JRedirector.py | 39 | ||||
-rw-r--r-- | Products/JRedirector/LICENSE.txt | 129 | ||||
-rw-r--r-- | Products/JRedirector/README.txt | 323 | ||||
-rw-r--r-- | Products/JRedirector/VERSION.txt | 2 | ||||
-rw-r--r-- | Products/JRedirector/__init__.py | 21 |
8 files changed, 340 insertions, 355 deletions
diff --git a/Products/JRedirector/CHANGES.txt b/Products/JRedirector/CHANGES.txt index cccd91f..a62630a 100644 --- a/Products/JRedirector/CHANGES.txt +++ b/Products/JRedirector/CHANGES.txt @@ -1,116 +1,106 @@ -JRedirector version and change information +Changelog +========= - 1.3 +1.4 (unreleased) +---------------- - Features added: +- Product eggification - - Allow selection of varying log levels including no - logging at all. This should put all those at ease who - saw alarming ZODB growth on very busy sites that see - a lot of redirections. +- License change to use ZPL 2.1 - - Added interoperability with virtual hosting. The latest - versions of Zope seemed to have changed the values that - get inserted into the PATH_INFO REQUEST-variable if a - VirtualHostMonster is used. (Tracker item 208) - 1.2 +1.3 (2002-12-13) +---------------- - Features added: +- Feature: Allow selection of varying log levels including no + logging at all. This should put all those at ease who saw + alarming ZODB growth on very busy sites that see a lot of + redirections. - - Provide data for the Undo tab entries produced by the - JRedirector +- Feature: Added interoperability with virtual hosting. The + latest versions of Zope seemed to have changed the values that + get inserted into the PATH_INFO REQUEST-variable if a + VirtualHostMonster is used. (Tracker item 208) - - Change the internal storage of logging data to be more - efficient. This change is automatically applied to - existing JRedirector instances the first time the log - is accessed, either during a redirect or when the - administrator looks up the log history in the Zope - management interface. This should also fix Tracker - issue 197 if it was a real issue (my own testing did - not support these conclusions). +1.2 (2002-12-05) +---------------- - 1.1 +- Feature: Provide data for the Undo tab entries produced by the + JRedirector - This is the "Josef Meile Appreciation Release". Virtually - all suggestions for improvements in this release came from - Josef. +- Feature: Change the internal storage of logging data to be more + efficient. This change is automatically applied to existing + JRedirector instances the first time the log is accessed, either + during a redirect or when the administrator looks up the log + history in the Zope management interface. This should also fix + Tracker issue 197 if it was a real issue (my own testing did + not support these conclusions). - Features added: - - Referrers to faulty URLs are now tracked as well. They - are listed on the Log tab. +1.1 (2002-10-20) +---------------- - - Mappings and Log views have been reorganized a little - to be more obvious about what they show and to avoid - having to scroll the browser window sideways if a URL - is overly long. +This is the "Josef Meile Appreciation Release". Virtually +all suggestions for improvements in this release came from +Josef. - - All displayed URLs are now clickable and will open in a - new window. This allows for quickly testing the old and - new paths on the Mappings tab as well as the referrers - listed on the Log tab. +- Feature: Referrers to faulty URLs are now tracked as well. They + are listed on the Log tab. - - Old paths that are specified with a trailing "/" (slash) - characters will have it stripped to prevent matches on - directory paths failing because most people just don't - use trailing slashes when referring to directories. +- Feature: Mappings and Log views have been reorganized a little + to be more obvious about what they show and to avoid having to + scroll the browser window sideways if a URL is overly long. +- Feature: All displayed URLs are now clickable and will open in a + new window. This allows for quickly testing the old and new paths + on the Mappings tab as well as the referrers listed on the Log tab. - 1.0 +- Feature: Old paths that are specified with a trailing "/" (slash) + characters will have it stripped to prevent matches on directory + paths failing because most people just don't use trailing slashes + when referring to directories. - Features added: - - Case-insensitive matching of requested paths to redirects - (first suggested by Josef Meile). +1.0 (2002-10-12) +---------------- - - Ability to clear the current logs from the ZMI (suggested - by Josef Meile). +- Feature: Case-insensitive matching of requested paths to redirects + (first suggested by Josef Meile). - - Multiple paths can now be redirected to a single new path - by specifying a "Wildcard Mapping". Wildcard mappings are - used for those requested URLs that... +- Feature: Ability to clear the current logs from the ZMI (suggested + by Josef Meile). - - have not matched any other non-wildcard rule +- Feature: Multiple paths can now be redirected to a single new path + by specifying a "Wildcard Mapping". Wildcard mappings are used for + those requested URLs that have not matched any other non-wildcard + rule and that are *underneath* the path specified as Old Path when + setting up the mapping. - - are *underneath* the path specified as Old Path when - setting up the mapping. +- Feature: Added more allowed HTTP response codes and an explanation + of these codes in README.txt - - Added more allowed HTTP response codes and an explanation - of these codes in README.txt +- Bug: Highlight the correct ZMI tab after submitting anything from + the "Mappings" and "Log" tab. - Bugs fixed: +- Bug: Use REQUEST.PATH_INFO instead of REQUEST.URL because + PATH_INFO always contains the full path during traversal, + whereas URL only contains the path up to the currently + traversed element. This fixes a bug that prevented redirecting + to a path that had nothing in common with the requested + path. Thanks to Josef Meile for pointing this out. - - Highlight the correct ZMI tab after submitting anything - from the "Mappings" and "Log" tab. - - Use REQUEST.PATH_INFO instead of REQUEST.URL because - PATH_INFO always contains the full path during traversal, - whereas URL only contains the path up to the currently - traversed element. This fixes a bug that prevented redirecting - to a path that had nothing in common with the requested - path. Thanks to Josef Meile for pointing this out. +1.0beta2 (2002-01-16) +--------------------- +- Feature: __call__ is now equivalent to calling the redirect method, + making usage even easier. Now you can just activate it like + this: `redirector_object(REQUEST)` - 1.0beta2 - Features added: +1.0beta1 (2002-01-16) +--------------------- - * __call__ is now equivalent to calling the redirect method, - making usage even easier. Now you can just activate it like - this:: - - redirector_object(REQUEST) - - - - 1.0beta1 - - First working code version - - - 0.5 - - Started putting the files together +- First working code version diff --git a/Products/JRedirector/COPYRIGHT.txt b/Products/JRedirector/COPYRIGHT.txt new file mode 100644 index 0000000..dea3476 --- /dev/null +++ b/Products/JRedirector/COPYRIGHT.txt @@ -0,0 +1,9 @@ +Copyright (c) 2002-2009 Jens Vagelpohl and Contributors. +All Rights Reserved. + +This software is subject to the provisions of the Zope Public License, +Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +FOR A PARTICULAR PURPOSE. diff --git a/Products/JRedirector/INSTALL.txt b/Products/JRedirector/INSTALL.txt deleted file mode 100644 index 6270db6..0000000 --- a/Products/JRedirector/INSTALL.txt +++ /dev/null @@ -1,16 +0,0 @@ -Installing the JRedirector Product - - You will need Zope version 2.4.0 or higher! - - This product does not require any special handling after unzipping - and untarring it in the Zope Products directory. You should do - something like:: - - $ cp JRedirector-xyz.tgz <zope_root>/lib/python/Products - $ cd <zope_root>/lib/python/Products - $ tar zxvf JRedirector-xyz.tgz - <watch files being decompressed> - - That's all. Do not forget to restart Zope afterwards. - - See README.txt for any other dependencies and requirements. diff --git a/Products/JRedirector/JRedirector.py b/Products/JRedirector/JRedirector.py index fbc2cd5..1f8ccea 100644 --- a/Products/JRedirector/JRedirector.py +++ b/Products/JRedirector/JRedirector.py @@ -1,24 +1,35 @@ ############################################################################## # -# JRedirector Perform and log redirections +# Copyright (c) 2002-2009 Jens Vagelpohl and Contributors. All Rights Reserved. # -# This software is governed by a license. See -# LICENSE.txt for the terms of this license. +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. # -############################################################################### +############################################################################## +""" JRedirector main module -__doc__ = """ JRedirector Module """ -__version__='$Revision$'[11:-2] +$Id$ +""" + +import os +import time -import os, time -from DateTime.DateTime import DateTime -from Acquisition import aq_inner, aq_parent -from AccessControl.Permissions import view_management_screens, manage_properties from AccessControl import ClassSecurityInfo -from OFS.SimpleItem import SimpleItem +from AccessControl.Permissions import manage_properties +from AccessControl.Permissions import view_management_screens +from Acquisition import aq_inner +from Acquisition import aq_parent +from App.class_init import default__class_init__ as InitializeClass +from App.Common import package_home +from App.special_dtml import DTMLFile from BTrees.OOBTree import OOBTree -from Globals import DTMLFile, InitializeClass, MessageDialog, \ - PersistentMapping, package_home +from DateTime.DateTime import DateTime +from OFS.SimpleItem import SimpleItem +from Globals import MessageDialog, PersistentMapping _dtmldir = os.path.join(package_home(globals()), 'dtml') addJRedirectorForm = DTMLFile('add', _dtmldir) @@ -270,7 +281,7 @@ class JRedirector(SimpleItem): return self.manage_map(manage_tabs_message=msg) - security.declareProtected(manage_properties, 'deleteRedirectorMapping') + security.declareProtected(manage_properties, 'deleteRedirectorMappings') def deleteRedirectorMappings(self, old_paths, REQUEST=None): """ Delete a redirector mapping """ for old_path in old_paths: diff --git a/Products/JRedirector/LICENSE.txt b/Products/JRedirector/LICENSE.txt index 706ce9c..89be00b 100644 --- a/Products/JRedirector/LICENSE.txt +++ b/Products/JRedirector/LICENSE.txt @@ -1,77 +1,54 @@ -############################################################################## -# -# License -# ------- -# -# Copyright (c) Jens Vagelpohl. All right reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions in source code must retain the above copyright -# notice, this list of conditions, and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions, and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. Jens Vagelpohl requests that attribution be given to Zope -# in any manner possible. A significant investment has been put -# into Zope, and this effort will continue if the Zope community -# continues to grow. This is one way to assure that growth. -# -# 4. All advertising materials and documentation mentioning -# features derived from or use of this software must display -# the following acknowledgement: -# -# "This product includes software developed by Jens Vagelpohl -# for use in the Z Object Publishing Environment -# (http://www.zope.org/)." -# -# In the event that the product being advertised includes an -# intact JRedirector distribution (with copyright and license -# included) then this clause is waived -# -# 5. Names associated with Jens Vagelpohl must not be used to -# endorse or promote products derived from this software without -# prior written permission from Jens Vagelpohl. -# -# 6. Modified redistributions of any form whatsoever must retain -# the following acknowledgment: -# -# "This product includes software developed by Jens Vagelpohl -# for use in the Z Object Publishing Environment -# (http://www.zope.org/)." -# -# Intact (re-)distributions of any official JRedirector -# release do not require an external acknowledgement. -# -# 7. Modifications are encouraged but must be packaged separately as -# patches to official software releases. Distributions that do not -# clearly separate the patches from the original work must be clearly -# labeled as unofficial distributions. -# -# 8. In the interest of improving this product the author requests that -# changes be made available to him. This is not mandatory but part -# of good open source development etiquette. -# -# -# Disclaimer -# -# THIS SOFTWARE IS PROVIDED BY JENS VAGELPOHL ``AS IS'' AND ANY -# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JENS VAGELPOHL OR HIS -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -############################################################################## +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that +identifies the copyright holders. + +This license has been certified as open source. It has also +been designated as GPL compatible by the Free Software +Foundation (FSF). + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the +following conditions are met: + +1. Redistributions in source code must retain the + accompanying copyright notice, this list of conditions, + and the following disclaimer. + +2. Redistributions in binary form must reproduce the accompanying + copyright notice, this list of conditions, and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +3. Names of the copyright holders must not be used to + endorse or promote products derived from this software + without prior written permission from the copyright + holders. + +4. The right to distribute this software or to use it for + any purpose does not give you the right to use + Servicemarks (sm) or Trademarks (tm) of the copyright + holders. Use of them is covered by separate agreement + with the copyright holders. + +5. If any files are modified, you must cause the modified + files to carry prominent notices stating that you changed + the files and the date of any change. + +Disclaimer + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' + AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + NO EVENT SHALL THE COPYRIGHT HOLDERS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. diff --git a/Products/JRedirector/README.txt b/Products/JRedirector/README.txt index 7576e28..9e418ef 100644 --- a/Products/JRedirector/README.txt +++ b/Products/JRedirector/README.txt @@ -1,161 +1,168 @@ -README for the Zope JRedirector Product - - The JRedirector package provides an object that is capable of - redirecting web requests in a controlled fashion and keeping logs - about it. - - I wrote it so that when I move pieces of my sites around I have - a way of specifying where users will go if they navigate to the old - obsolete location. This is helpful if your site is linked from - other sites and you have no control over the accuracy of these - outside links. - - The administrator can add mappings from old path to new path where - the user will be redirected to when he tries to visit the old path. - The HTTP header sent along with this redirect can be specified, - available choices are "301" (moved permanently) or "302" (moved - temporarily). - - The object will keep an internal log of all web requests that are - referred to it and presents it on a logging output page. - - - **Usage** - - The administrator creates a JRedirector object in a given - location in site. Invoking the redirection capabilities must happen - explicitly, for example from standard_error_message, by calling - the JRedirector object and passing REQUEST. - - As an example, here is the snippet of my standard_html_error that - invokes the JRedirector object: - - < dtml-if expr="error_type == 'NotFound'"> - < dtml-call expr="redirector_object(REQUEST)"> - < /dtml-if> - - This will fire whenever a "NotFound" error occurs. If the path - the user attempted to go to is not in the explicitly mapped - list of paths defined by the administrator in the JRedirector - object "Mappings" tab then nothing will happen and the - standard_error_message will continue to render normally. If the - looked-for path is explicitly mapped then the user will be - redirected and will never see standard_error_message. +====================== + Products.JRedirector +====================== + +.. contents: + +The JRedirector package provides an object that is capable of +redirecting web requests in a controlled fashion and keeping logs +about it. + +I wrote it so that when I move pieces of my sites around I have +a way of specifying where users will go if they navigate to the old +obsolete location. This is helpful if your site is linked from +other sites and you have no control over the accuracy of these +outside links. + +The administrator can add mappings from old path to new path where +the user will be redirected to when he tries to visit the old path. +The HTTP header sent along with this redirect can be specified, +available choices are "301" (moved permanently) or "302" (moved +temporarily). + +The object will keep an internal log of all web requests that are +referred to it and presents it on a logging output page. + + +Usage +===== +The administrator creates a JRedirector object in a given +location in site. Invoking the redirection capabilities must happen +explicitly, for example from standard_error_message, by calling +the JRedirector object and passing REQUEST. + +As an example, here is the snippet of my standard_html_error that +invokes the JRedirector object:: + +< dtml-if expr="error_type == 'NotFound'"> + < dtml-call expr="redirector_object(REQUEST)"> +< /dtml-if> + +This will fire whenever a "NotFound" error occurs. If the path +the user attempted to go to is not in the explicitly mapped +list of paths defined by the administrator in the JRedirector +object "Mappings" tab then nothing will happen and the +standard_error_message will continue to render normally. If the +looked-for path is explicitly mapped then the user will be +redirected and will never see standard_error_message. - **Requirements** - - In order for this product to run you will need to provide the - following items: - - * A running Zope site version 2.4 or higher - - - **Tested Platforms and versions** - - This product has been written on and for Zope 2.4.0 and up. I am - not going to support earlier versions of Zope with my product. - +Requirements +============ +This package requires Zope 2.8 and up. + + +HTTP Status Codes related to redirecting requests +================================================= +The following is taken from RFC 2616 which describes the HTTP/1.1 +specification. The RFCs can be found in various locations on the +Internet, I found it here:: + + ftp://ftp.isi.edu/in-notes/rfc2616.txt + +Not all status codes are understood by all browsers. If you are worried +about older browsers you should restrict your usage to status codes +301 for permanently moved pages and 302 for temporary moves. + +301 Moved Permanently +--------------------- +The requested resource has been assigned a new permanent URI and any +future references to this resource SHOULD use one of the returned +URIs. Clients with link editing capabilities ought to automatically +re-link references to the Request-URI to one or more of the new +references returned by the server, where possible. This response is +cacheable unless indicated otherwise. + +The new permanent URI SHOULD be given by the Location field in the +response. Unless the request method was HEAD, the entity of the +response SHOULD contain a short hypertext note with a hyperlink to +the new URI(s). + +If the 301 status code is received in response to a request other +than GET or HEAD, the user agent MUST NOT automatically redirect the +request unless it can be confirmed by the user, since this might +change the conditions under which the request was issued. + +Note: When automatically redirecting a POST request after +receiving a 301 status code, some existing HTTP/1.0 user agents +will erroneously change it into a GET request. + +302 Found +--------- +The requested resource resides temporarily under a different URI. +Since the redirection might be altered on occasion, the client SHOULD +continue to use the Request-URI for future requests. This response +is only cacheable if indicated by a Cache-Control or Expires header +field. + +The temporary URI SHOULD be given by the Location field in the +response. Unless the request method was HEAD, the entity of the +response SHOULD contain a short hypertext note with a hyperlink to +the new URI(s). + +If the 302 status code is received in response to a request other +than GET or HEAD, the user agent MUST NOT automatically redirect the +request unless it can be confirmed by the user, since this might +change the conditions under which the request was issued. + +Note: RFC 1945 and RFC 2068 specify that the client is not allowed +to change the method on the redirected request. However, most +existing user agent implementations treat 302 as if it were a 303 +response, performing a GET on the Location field-value regardless +of the original request method. The status codes 303 and 307 have +been added for servers that wish to make unambiguously clear which +kind of reaction is expected of the client. + +303 See Other +------------- +The response to the request can be found under a different URI and +SHOULD be retrieved using a GET method on that resource. This method +exists primarily to allow the output of a POST-activated script to +redirect the user agent to a selected resource. The new URI is not a +substitute reference for the originally requested resource. The 303 +response MUST NOT be cached, but the response to the second +(redirected) request might be cacheable. + +The different URI SHOULD be given by the Location field in the +response. Unless the request method was HEAD, the entity of the +response SHOULD contain a short hypertext note with a hyperlink to +the new URI(s). + +Note: Many pre-HTTP/1.1 user agents do not understand the 303 +status. When interoperability with such clients is a concern, the +302 status code may be used instead, since most user agents react +to a 302 response as described here for 303. + +307 Temporary Redirect +---------------------- +The requested resource resides temporarily under a different URI. +Since the redirection MAY be altered on occasion, the client SHOULD +continue to use the Request-URI for future requests. This response +is only cacheable if indicated by a Cache-Control or Expires header +field. + +The temporary URI SHOULD be given by the Location field in the +response. Unless the request method was HEAD, the entity of the +response SHOULD contain a short hypertext note with a hyperlink to +the new URI(s) , since many pre-HTTP/1.1 user agents do not +understand the 307 status. Therefore, the note SHOULD contain the +information necessary for a user to repeat the original request on +the new URI. + +If the 307 status code is received in response to a request other +than GET or HEAD, the user agent MUST NOT automatically redirect the +request unless it can be confirmed by the user, since this might +change the conditions under which the request was issued. + +Bug tracker +=========== +If you have suggestions, bug reports or requests please use the issue +tracker at http://www.dataflake.org/tracker/ + +SVN version +=========== +You can retrieve the latest code from Subversion using setuptools or +zc.buildout via this URL: + +http://svn.dataflake.org/svn/Products.JRedirector/trunk#egg=Products.JRedirector - **HTTP Status Codes related to redirecting requests** - - The following is taken from RFC 2616 which describes the HTTP/1.1 - specification. The RFCs can be found in various locations on the - Internet, I found it here:: - - ftp://ftp.isi.edu/in-notes/rfc2616.txt - - Not all status codes are understood by all browsers. If you are worried - about older browsers you should restrict your usage to status codes - 301 for permanently moved pages and 302 for temporary moves. - - - **301 Moved Permanently** - - The requested resource has been assigned a new permanent URI and any - future references to this resource SHOULD use one of the returned - URIs. Clients with link editing capabilities ought to automatically - re-link references to the Request-URI to one or more of the new - references returned by the server, where possible. This response is - cacheable unless indicated otherwise. - - The new permanent URI SHOULD be given by the Location field in the - response. Unless the request method was HEAD, the entity of the - response SHOULD contain a short hypertext note with a hyperlink to - the new URI(s). - - If the 301 status code is received in response to a request other - than GET or HEAD, the user agent MUST NOT automatically redirect the - request unless it can be confirmed by the user, since this might - change the conditions under which the request was issued. - - Note: When automatically redirecting a POST request after - receiving a 301 status code, some existing HTTP/1.0 user agents - will erroneously change it into a GET request. - - **302 Found** - - The requested resource resides temporarily under a different URI. - Since the redirection might be altered on occasion, the client SHOULD - continue to use the Request-URI for future requests. This response - is only cacheable if indicated by a Cache-Control or Expires header - field. - - The temporary URI SHOULD be given by the Location field in the - response. Unless the request method was HEAD, the entity of the - response SHOULD contain a short hypertext note with a hyperlink to - the new URI(s). - - If the 302 status code is received in response to a request other - than GET or HEAD, the user agent MUST NOT automatically redirect the - request unless it can be confirmed by the user, since this might - change the conditions under which the request was issued. - - Note: RFC 1945 and RFC 2068 specify that the client is not allowed - to change the method on the redirected request. However, most - existing user agent implementations treat 302 as if it were a 303 - response, performing a GET on the Location field-value regardless - of the original request method. The status codes 303 and 307 have - been added for servers that wish to make unambiguously clear which - kind of reaction is expected of the client. - - **303 See Other** - - The response to the request can be found under a different URI and - SHOULD be retrieved using a GET method on that resource. This method - exists primarily to allow the output of a POST-activated script to - redirect the user agent to a selected resource. The new URI is not a - substitute reference for the originally requested resource. The 303 - response MUST NOT be cached, but the response to the second - (redirected) request might be cacheable. - - The different URI SHOULD be given by the Location field in the - response. Unless the request method was HEAD, the entity of the - response SHOULD contain a short hypertext note with a hyperlink to - the new URI(s). - - Note: Many pre-HTTP/1.1 user agents do not understand the 303 - status. When interoperability with such clients is a concern, the - 302 status code may be used instead, since most user agents react - to a 302 response as described here for 303. - - **307 Temporary Redirect** - - The requested resource resides temporarily under a different URI. - Since the redirection MAY be altered on occasion, the client SHOULD - continue to use the Request-URI for future requests. This response - is only cacheable if indicated by a Cache-Control or Expires header - field. - - The temporary URI SHOULD be given by the Location field in the - response. Unless the request method was HEAD, the entity of the - response SHOULD contain a short hypertext note with a hyperlink to - the new URI(s) , since many pre-HTTP/1.1 user agents do not - understand the 307 status. Therefore, the note SHOULD contain the - information necessary for a user to repeat the original request on - the new URI. - - If the 307 status code is received in response to a request other - than GET or HEAD, the user agent MUST NOT automatically redirect the - request unless it can be confirmed by the user, since this might - change the conditions under which the request was issued. diff --git a/Products/JRedirector/VERSION.txt b/Products/JRedirector/VERSION.txt index 7e32cd5..d245be4 100644 --- a/Products/JRedirector/VERSION.txt +++ b/Products/JRedirector/VERSION.txt @@ -1 +1 @@ -1.3 +1.4dev diff --git a/Products/JRedirector/__init__.py b/Products/JRedirector/__init__.py index 1d8fbcd..909f5bb 100644 --- a/Products/JRedirector/__init__.py +++ b/Products/JRedirector/__init__.py @@ -1,16 +1,23 @@ ############################################################################## # -# __init__.py Initialization code for the JRedirector package +# Copyright (c) 2002-2009 Jens Vagelpohl and Contributors. All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. # -# This software is governed by a license. See -# LICENSE.txt for the terms of this license. -# ############################################################################## +""" WatermarkImage initialization -__doc__ = """ JRedirector initialization module """ -__version__ = '$Revision$'[11:-2] +$Id$ +""" -from JRedirector import JRedirector, manage_addJRedirector, addJRedirectorForm +from JRedirector import addJRedirectorForm +from JRedirector import JRedirector +from JRedirector import manage_addJRedirector def initialize(context): context.registerClass( JRedirector |