Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
CMFDefault.Link.Link Class Reference
Inheritance diagram for CMFDefault.Link.Link:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.Link.Link:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def manage_editLink
def edit
def SearchableText
def getRemoteUrl
def PUT
 FTP handlers.
def manage_FTPget
def get_size

Public Attributes

 id
 title
 description
 format
 remote_url

Static Public Attributes

string URL_FORMAT = 'text/url'
 effective_date = expiration_dateNone
tuple security = ClassSecurityInfo()
tuple manage_edit = DTMLFile( 'zmi_editLink', _dtmldir )

Private Member Functions

def _edit
def _writeFromPUT

Static Private Attributes

tuple __implements__

Detailed Description

A Link.

Definition at line 55 of file Link.py.


Constructor & Destructor Documentation

def CMFDefault.Link.Link.__init__ (   self,
  id,
  title = '',
  remote_url = '',
  description = '' 
)

Definition at line 75 of file Link.py.

00075 
00076                 ):
00077         DefaultDublinCoreImpl.__init__(self)
00078         self.id=id
00079         self.title=title
00080         self.description=description
00081         self._edit(remote_url)
00082         self.format=self.URL_FORMAT


Member Function Documentation

def CMFDefault.Link.Link._edit (   self,
  remote_url 
) [private]
    Edit the Link

Definition at line 99 of file Link.py.

00099 
00100     def _edit( self, remote_url ):
00101         """
00102             Edit the Link
00103         """
00104         tokens = urlparse.urlparse( remote_url, 'http' )
00105         if tokens[0] == 'http':
00106             if tokens[1]:
00107                 # We have a nethost. All is well.
00108                 url = urlparse.urlunparse(tokens)
00109             elif tokens[2:] == ('', '', '', ''):
00110                 # Empty URL
00111                 url = ''
00112             else:
00113                 # Relative URL, keep it that way, without http:
00114                 tokens = ('', '') + tokens[2:]
00115                 url = urlparse.urlunparse(tokens)
00116         else:
00117             # Other scheme, keep original
00118             url = urlparse.urlunparse(tokens)
00119         self.remote_url = url

Here is the caller graph for this function:

def CMFDefault.Link.Link._writeFromPUT (   self,
  body 
) [private]

Definition at line 141 of file Link.py.

00141 
00142     def _writeFromPUT( self, body ):
00143         headers = {}
00144         headers, body = parseHeadersBody(body, headers)
00145         lines = body.split('\n')
00146         self.edit( lines[0] )
00147         headers['Format'] = self.URL_FORMAT
00148         new_subject = keywordsplitter(headers)
00149         headers['Subject'] = new_subject or self.Subject()
00150         new_contrib = contributorsplitter(headers)
00151         headers['Contributors'] = new_contrib or self.Contributors()
00152         haveheader = headers.has_key
00153         for key, value in self.getMetadataHeaders():
00154             if not haveheader(key):
00155                 headers[key] = value
00156 
00157         self._editMetadata(title=headers['Title'],
00158                           subject=headers['Subject'],
00159                           description=headers['Description'],
00160                           contributors=headers['Contributors'],
00161                           effective_date=headers['Effective_date'],
00162                           expiration_date=headers['Expiration_date'],
00163                           format=headers['Format'],
00164                           language=headers['Language'],
00165                           rights=headers['Rights'],
00166                           )

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFDefault.Link.Link.edit (   self,
  remote_url 
)
Update and reindex. 

Definition at line 121 of file Link.py.

00121 
00122     def edit(self, remote_url ):
00123         """ Update and reindex. """
00124         self._edit( remote_url )
00125         self.reindexObject()

Here is the call graph for this function:

Here is the caller graph for this function:

Used for FTP and apparently the ZMI now too.

Definition at line 197 of file Link.py.

00197 
00198     def get_size( self ):
00199         """ Used for FTP and apparently the ZMI now too.
00200         """
00201         return len(self.manage_FTPget())
00202 
00203 InitializeClass(Link)

Here is the call graph for this function:

Here is the caller graph for this function:

    returns the remote URL of the Link

Definition at line 134 of file Link.py.

00134 
00135     def getRemoteUrl(self):
00136         """
00137             returns the remote URL of the Link
00138         """
00139         return self.remote_url

Here is the caller graph for this function:

def CMFDefault.Link.Link.manage_editLink (   self,
  remote_url,
  REQUEST = None 
)
    Update the Link via the ZMI.

Definition at line 87 of file Link.py.

00087 
00088     def manage_editLink( self, remote_url, REQUEST=None ):
00089         """
00090             Update the Link via the ZMI.
00091         """
00092         self._edit( remote_url )
00093         if REQUEST is not None:
00094             REQUEST['RESPONSE'].redirect( self.absolute_url()
00095                                         + '/manage_edit'
00096                                         + '?manage_tabs_message=Link+updated'
00097                                         )

Here is the call graph for this function:

    Get the link as text for WebDAV src / FTP download.

Definition at line 186 of file Link.py.

00186 
00187     def manage_FTPget(self):
00188         """
00189             Get the link as text for WebDAV src / FTP download.
00190         """
00191         hdrlist = self.getMetadataHeaders()
00192         hdrtext = formatRFC822Headers( hdrlist )
00193         bodytext = '%s\n\n%s' % ( hdrtext, self.getRemoteUrl() )
00194 
00195         return bodytext

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFDefault.Link.Link.PUT (   self,
  REQUEST,
  RESPONSE 
)

FTP handlers.

    Handle HTTP / WebDAV / FTP PUT requests.

Definition at line 169 of file Link.py.

00169 
00170     def PUT(self, REQUEST, RESPONSE):
00171         """
00172             Handle HTTP / WebDAV / FTP PUT requests.
00173         """
00174         self.dav__init(REQUEST, RESPONSE)
00175         self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
00176         body = REQUEST.get('BODY', '')
00177         try:
00178             self._writeFromPUT( body )
00179             RESPONSE.setStatus(204)
00180             return RESPONSE
00181         except ResourceLockedError, msg:
00182             transaction.abort()
00183             RESPONSE.setStatus(423)
00184             return RESPONSE

Here is the call graph for this function:

    text for indexing

Definition at line 127 of file Link.py.

00127 
00128     def SearchableText(self):
00129         """
00130             text for indexing
00131         """
00132         return "%s %s" % (self.title, self.description)

Here is the caller graph for this function:


Member Data Documentation

tuple CMFDefault.Link.Link.__implements__ [static, private]
Initial value:
( PortalContent.__implements__
                     , DefaultDublinCoreImpl.__implements__
                     )

Definition at line 61 of file Link.py.

Definition at line 79 of file Link.py.

CMFDefault.Link.Link.effective_date = expiration_dateNone [static]

Definition at line 66 of file Link.py.

Definition at line 81 of file Link.py.

Definition at line 77 of file Link.py.

tuple CMFDefault.Link.Link.manage_edit = DTMLFile( 'zmi_editLink', _dtmldir ) [static]

Definition at line 84 of file Link.py.

Definition at line 118 of file Link.py.

tuple CMFDefault.Link.Link.security = ClassSecurityInfo() [static]

Definition at line 68 of file Link.py.

Definition at line 78 of file Link.py.

string CMFDefault.Link.Link.URL_FORMAT = 'text/url' [static]

Definition at line 65 of file Link.py.


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