[Checkins] SVN: zc.resourcelibrary/trunk/ fixed the check for
HTML and XML content to allow content type parameters
Jim Fulton
jim at zope.com
Thu Dec 6 14:59:17 EST 2007
This change breaks if the content-type is None. This is the case when
rendering the Unauthorized page when using session authentication. The
end result is that session auth fails. Users get a fall-back error
page, rather than getting redirected to the login page.
You need to check whether content-type is a string before calling
string methods on it.
Jim
On Dec 4, 2007, at 4:36 PM, Thomas Lotze wrote:
> Log message for revision 82127:
> fixed the check for HTML and XML content to allow content type
> parameters
>
> Changed:
> U zc.resourcelibrary/trunk/CHANGES.txt
> U zc.resourcelibrary/trunk/src/zc/resourcelibrary/publication.py
>
> -=-
> Modified: zc.resourcelibrary/trunk/CHANGES.txt
> ===================================================================
> --- zc.resourcelibrary/trunk/CHANGES.txt 2007-12-04 20:50:17 UTC
> (rev 82126)
> +++ zc.resourcelibrary/trunk/CHANGES.txt 2007-12-04 21:36:12 UTC
> (rev 82127)
> @@ -2,6 +2,11 @@
> CHANGES
> =======
>
> +0.6.2 (2007-12-04)
> +------------------
> +
> +- fixed the check for HTML and XML content to allow content type
> parameters
> +
> 0.6.1 (2007-11-03)
> ------------------
>
>
> Modified: zc.resourcelibrary/trunk/src/zc/resourcelibrary/
> publication.py
> ===================================================================
> --- zc.resourcelibrary/trunk/src/zc/resourcelibrary/publication.py
> 2007-12-04 20:50:17 UTC (rev 82126)
> +++ zc.resourcelibrary/trunk/src/zc/resourcelibrary/publication.py
> 2007-12-04 21:36:12 UTC (rev 82127)
> @@ -71,7 +71,9 @@
> if isHTML(body):
> content_type = 'text/html'
>
> - if content_type == 'text/html' or content_type == 'text/xml':
> + # check the content type disregarding parameters,
> whitespace and case
> + if content_type.split(';', 1)[0].strip().lower() in (
> + 'text/html', 'text/xml'):
> #act on HTML and XML content only!
>
> self.resource_libraries =
> self._addDependencies(self.resource_libraries)
>
> _______________________________________________
> Checkins mailing list
> Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/checkins
--
Jim Fulton
Zope Corporation
More information about the Checkins
mailing list