Back to index

plone3  3.1.7
Private Member Functions
CMFDefault.browser.favorite.FavoriteURIWidget Class Reference
Inheritance diagram for CMFDefault.browser.favorite.FavoriteURIWidget:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.browser.favorite.FavoriteURIWidget:
Collaboration graph
[legend]

List of all members.

Private Member Functions

def _toFieldValue

Detailed Description

Custom widget for remote_url.

Definition at line 68 of file favorite.py.


Member Function Documentation

def CMFDefault.browser.favorite.FavoriteURIWidget._toFieldValue (   self,
  input 
) [private]

Definition at line 73 of file favorite.py.

00073 
00074     def _toFieldValue(self, input):
00075         value = super(FavoriteURIWidget, self)._toFieldValue(input)
00076         if not value:
00077             return value
00078         # strip off scheme and machine from URL if present
00079         tokens = urlparse.urlparse(value, 'http')
00080         if tokens[1]:
00081             # There is a nethost, remove it
00082             tokens = ('', '') + tokens[2:]
00083             value = urlparse.urlunparse(tokens)
00084         # if URL begins with site URL, remove site URL
00085         obj = self.context.context.context
00086         portal_url = getToolByName(obj, 'portal_url').getPortalPath()
00087         if value.startswith(portal_url):
00088             value = value[len(portal_url):]
00089         # if site is still absolute, make it relative
00090         if value[:1]=='/':
00091             value = value[1:]
00092         return value
00093 

Here is the call graph for this function:


The documentation for this class was generated from the following file: