entities/lib.py
changeset 2828 306fe72bfd07
parent 2098 13aab3775af7
child 3230 1d25e928c299
equal deleted inserted replaced
2827:d1a89d165045 2828:306fe72bfd07
    82         if self.email_of:
    82         if self.email_of:
    83             return self.email_of.rest_path(), {}
    83             return self.email_of.rest_path(), {}
    84         return super(EmailAddress, self).after_deletion_path()
    84         return super(EmailAddress, self).after_deletion_path()
    85 
    85 
    86 
    86 
    87 from logilab.common.deprecation import class_renamed
    87 class Bookmark(AnyEntity):
    88 Emailaddress = class_renamed('Emailaddress', EmailAddress)
    88     """customized class for Bookmark entities"""
    89 Emailaddress.id = 'Emailaddress'
    89     id = 'Bookmark'
       
    90     fetch_attrs, fetch_order = fetch_config(['title', 'path'])
       
    91 
       
    92     def actual_url(self):
       
    93         url = self.req.build_url(self.path)
       
    94         if self.title:
       
    95             urlparts = list(urlsplit(url))
       
    96             if urlparts[3]:
       
    97                 urlparts[3] += '&vtitle=%s' % self.req.url_quote(self.title)
       
    98             else:
       
    99                 urlparts[3] = 'vtitle=%s' % self.req.url_quote(self.title)
       
   100             url = urlunsplit(urlparts)
       
   101         return url
       
   102 
       
   103     def action_url(self):
       
   104         return self.absolute_url() + '/follow'
    90 
   105 
    91 
   106 
    92 class CWProperty(AnyEntity):
   107 class CWProperty(AnyEntity):
    93     id = 'CWProperty'
   108     id = 'CWProperty'
    94 
   109 
   109         information when this entity is being deleted
   124         information when this entity is being deleted
   110         """
   125         """
   111         return 'view', {}
   126         return 'view', {}
   112 
   127 
   113 
   128 
   114 class Bookmark(AnyEntity):
       
   115     """customized class for Bookmark entities"""
       
   116     id = 'Bookmark'
       
   117     fetch_attrs, fetch_order = fetch_config(['title', 'path'])
       
   118 
       
   119     def actual_url(self):
       
   120         url = self.req.build_url(self.path)
       
   121         if self.title:
       
   122             urlparts = list(urlsplit(url))
       
   123             if urlparts[3]:
       
   124                 urlparts[3] += '&vtitle=%s' % self.req.url_quote(self.title)
       
   125             else:
       
   126                 urlparts[3] = 'vtitle=%s' % self.req.url_quote(self.title)
       
   127             url = urlunsplit(urlparts)
       
   128         return url
       
   129 
       
   130     def action_url(self):
       
   131         return self.absolute_url() + '/follow'
       
   132 
       
   133 
       
   134 class CWCache(AnyEntity):
   129 class CWCache(AnyEntity):
   135     """Cache"""
   130     """Cache"""
   136     id = 'CWCache'
   131     id = 'CWCache'
   137     fetch_attrs, fetch_order = fetch_config(['name'])
   132     fetch_attrs, fetch_order = fetch_config(['name'])
   138 
   133