[Erp5-report] r13634 - /erp5/trunk/products/ERP5/Document/Url.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Mar 26 13:54:35 CEST 2007


Author: jp
Date: Mon Mar 26 13:54:34 2007
New Revision: 13634

URL: http://svn.erp5.org?rev=13634&view=rev
Log:
Made asURL method more robust.

Modified:
    erp5/trunk/products/ERP5/Document/Url.py

Modified: erp5/trunk/products/ERP5/Document/Url.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Url.py?rev=13634&r1=13633&r2=13634&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Url.py (original)
+++ erp5/trunk/products/ERP5/Document/Url.py Mon Mar 26 13:54:34 2007
@@ -51,7 +51,8 @@
                             'asURL')
   def asURL(self):
     """
-    Returns a text representation of the Url
+    Returns a text representation of the Url if defined
+    or None else.
     """
     protocol = self.getUrlProtocol()
     if not protocol:
@@ -63,6 +64,7 @@
       else:
         protocol = 'http'
     url_string = self.getUrlString()
+    if not url_string: return None
     if protocol in no_host_protocol_list or url_string.startswith('//'):
       return '%s:%s' % (protocol, url_string)
     return '%s://%s' % (protocol, url_string)




More information about the Erp5-report mailing list