Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Attributes
ATContentTypes.content.favorite.ATFavorite Class Reference
Inheritance diagram for ATContentTypes.content.favorite.ATFavorite:
Inheritance graph
[legend]
Collaboration diagram for ATContentTypes.content.favorite.ATFavorite:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def getRemoteUrl
def setRemoteUrl
def getIcon
def getObject
def cmf_edit

Static Public Attributes

 schema = ATFavoriteSchema
string portal_type = 'Favorite'
string archetype_name = 'Favorite'
tuple assocMimetypes = ()
tuple assocFileExt = ('fav', )
tuple cmf_edit_kws = ('remote_url',)
tuple security = ClassSecurityInfo()
tuple remote_url = ComputedAttribute(_getRemoteUrl, 1)

Private Member Functions

def _getRemoteUrl

Static Private Attributes

dictionary _atct_newTypeFor = {'portal_type' : 'CMF Favorite', 'meta_type' : 'Favorite'}
 __implements__ = ATCTContent.__implements__,IATFavorite

Detailed Description

A placeholder item linking to a favorite object in the site.

Definition at line 68 of file favorite.py.


Member Function Documentation

Accessor

Definition at line 100 of file favorite.py.

00100 
00101     def _getRemoteUrl(self):
00102         """Accessor
00103         """
00104         return self.getField('remoteUrl').get(self)

Here is the call graph for this function:

Here is the caller graph for this function:

def ATContentTypes.content.favorite.ATFavorite.cmf_edit (   self,
  remote_url = None,
  kwargs 
)

Definition at line 159 of file favorite.py.

00159 
00160     def cmf_edit(self, remote_url=None, **kwargs):
00161         self.update(remoteUrl = remote_url, **kwargs)
00162 
00163 registerATCT(ATFavorite, PROJECTNAME)
def ATContentTypes.content.favorite.ATFavorite.getIcon (   self,
  relative_to_portal = 0 
)
Instead of a static icon, like for Link objects, we want
to display an icon based on what the Favorite links to.

Definition at line 130 of file favorite.py.

00130 
00131     def getIcon(self, relative_to_portal=0):
00132         """Instead of a static icon, like for Link objects, we want
00133         to display an icon based on what the Favorite links to.
00134         """
00135         obj =  self.getObject()
00136         if obj is not None:
00137             return obj.getIcon(relative_to_portal)
00138         else:
00139             return 'favorite_broken_icon.gif'

Here is the call graph for this function:

Here is the caller graph for this function:

Return the actual object that the Favorite is
linking to

Definition at line 141 of file favorite.py.

00141 
00142     def getObject(self):
00143         """Return the actual object that the Favorite is
00144         linking to
00145         """
00146         utool  = getToolByName(self, 'portal_url')
00147         portal = utool.getPortalObject()
00148         relative_url = self._getRemoteUrl()
00149         try:
00150             obj = portal.restrictedTraverse(relative_url)
00151         except ConflictError:
00152             raise
00153         except (KeyError, AttributeError, Unauthorized, 'Unauthorized', ):
00154             ##LOG.error('Failed to get object for %s with url of %s' % (repr(self),
00155             ##          relative_url), exc_info=True)
00156             obj = None
00157         return obj

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 86 of file favorite.py.

00086 
00087     def getRemoteUrl(self):
00088         """returns the remote URL of the Link
00089         """
00090         # need to check why this is different than PortalLink
00091         utool  = getToolByName(self, 'portal_url')
00092         portal_url = utool()
00093         remote = self._getRemoteUrl()
00094         if remote:
00095             if remote.startswith('/'):
00096                 remote = remote[1:]
00097             return '%s/%s' % (portal_url, remote)
00098         else:
00099             return portal_url

Here is the call graph for this function:

Here is the caller graph for this function:

Set url relative to portal root

Definition at line 108 of file favorite.py.

00108 
00109     def setRemoteUrl(self, remote_url):
00110         """Set url relative to portal root
00111         """
00112         utool  = getToolByName(self, 'portal_url')
00113         # strip off scheme and machine from URL if present
00114         tokens = urlparse.urlparse(remote_url, 'http')
00115         if tokens[1]:
00116             # There is a nethost, remove it
00117             t=('', '') + tokens[2:]
00118             remote_url = urlparse.urlunparse(t)
00119         # if URL begins with site URL, remove site URL
00120         portal_url = utool.getPortalPath()
00121         i = remote_url.find(portal_url)
00122         if i==0:
00123             remote_url=remote_url[len(portal_url):]
00124         # if site is still absolute, make it relative
00125         if remote_url[:1]=='/':
00126             remote_url=remote_url[1:]
00127 
00128         self.getField('remoteUrl').set(self, remote_url)

Here is the call graph for this function:


Member Data Documentation

ATContentTypes.content.favorite.ATFavorite.__implements__ = ATCTContent.__implements__,IATFavorite [static, private]

Definition at line 80 of file favorite.py.

dictionary ATContentTypes.content.favorite.ATFavorite._atct_newTypeFor = {'portal_type' : 'CMF Favorite', 'meta_type' : 'Favorite'} [static, private]

Definition at line 75 of file favorite.py.

Definition at line 74 of file favorite.py.

Definition at line 77 of file favorite.py.

Definition at line 76 of file favorite.py.

Definition at line 78 of file favorite.py.

Definition at line 73 of file favorite.py.

Definition at line 105 of file favorite.py.

Definition at line 71 of file favorite.py.

tuple ATContentTypes.content.favorite.ATFavorite.security = ClassSecurityInfo() [static]

Definition at line 82 of file favorite.py.


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