[Erp5-report] r25559 - /erp5/trunk/products/ERP5/Document/Url.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Sat Feb 14 10:29:52 CET 2009
Author: jp
Date: Sat Feb 14 10:29:52 2009
New Revision: 25559
URL: http://svn.erp5.org?rev=25559&view=rev
Log:
Initial helper methods (used by external sources for example). Work in progress.
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=25559&r1=25558&r2=25559&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Url.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Url.py [utf8] Sat Feb 14 10:29:52 2009
@@ -85,6 +85,51 @@
url_string = url
self.setUrlString(url_string)
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getURLServer')
+ def getURLServer(self):
+ """
+ Returns the server part of a URL
+
+ XXX - we must add here more consistency checking
+ based on the protocol of the URL
+
+ XXX - regular expressions would be better
+ """
+ url_string = self.getUrlString()
+ return url_string.split('/')[0].split(':')[0]
+
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getURLPort')
+ def getURLPort(self):
+ """
+ Returns the port part of a URL
+
+ XXX - we must add here more consistency checking
+ based on the protocol of the URL
+
+ XXX - regular expressions would be better
+ """
+ url_string = self.getUrlString()
+ server_part_list = url_string.split('/')[0].split(':')
+ if len(server_part_list) > 1:
+ return server_part_list[1]
+ return None
+
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getURLPath')
+ def getURLPath(self):
+ """
+ Returns the path part of a URL
+
+ XXX - we must add here more consistency checking
+ based on the protocol of the URL
+
+ XXX - regular expressions would be better
+ """
+ url_string = self.getUrlString()
+ return '/'.join(url_string.split('/')[1:])
+
class Url(Coordinate, Base, UrlMixIn):
"""
A Url is allows to represent in a standard way coordinates
More information about the Erp5-report
mailing list