From 015387de8fa59118cbed46018bb8911c6e58507b Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Thu, 22 Mar 2007 14:45:01 +0000 Subject: [PATCH] Added some default values in dictionnaries. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13567 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Url.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/product/ERP5/Document/Url.py b/product/ERP5/Document/Url.py index 2de4905df3..d2b927645c 100644 --- a/product/ERP5/Document/Url.py +++ b/product/ERP5/Document/Url.py @@ -36,16 +36,17 @@ from base64 import encode from mimetools import choose_boundary from mimetypes import guess_type +no_crawl_protocol_list = ['mailto', 'javascript', ] +no_host_protocol_list = ['mailto', 'news', 'javascript',] +default_protocol_dict = { 'Email' : 'mailto', + } + class UrlMixIn: # Declarative security security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) - no_host_protocol_list = ['mailto', 'news', ] - default_protocol_dict = { 'Email' : 'mailto', - } - security.declareProtected(Permissions.AccessContentsInformation, 'asURL') def asURL(self): @@ -57,12 +58,12 @@ class UrlMixIn: # A quick fix for all objects which did not # define protocol such as email addresses ptype = self.getPortalType() - if UrlMixIn.default_protocol_dict.has_key(ptype): - protocol = UrlMixIn.default_protocol_dict[ptype] + if default_protocol_dict.has_key(ptype): + protocol = default_protocol_dict[ptype] else: protocol = 'http' url_string = self.getUrlString() - if protocol in UrlMixIn.no_host_protocol_list or url_string.startswith('//'): + if protocol in no_host_protocol_list or url_string.startswith('//'): return '%s:%s' % (protocol, url_string) return '%s://%s' % (protocol, url_string) -- 2.30.9