Exemplo n.º 1
0
 def guid(self):
     """Global unique identifier for this object"""
     id = first([getattr(self, key, None) for key in ('publish_id', 'external_id', 'id')])
     date = first([getattr(self, key, None) for key in ('published', 'activation_date', 'created', 'modified')])
     date = tzdatetime.new(date).utc
     meta = type(self)._meta
     return 'tag:%s,%s:/%s/%s/%d/%d' % (current_site.domain, date.strftime('%Y-%m-%d'), meta.app_label,
                                        meta.object_name.lower(), id, date.unixtime)
Exemplo n.º 2
0
 def guid(self):
     """Global unique identifier for this object"""
     id = first([getattr(self, key, None) for key in ('publish_id', 'external_id', 'id')])
     date = first([getattr(self, key, None) for key in ('published', 'activation_date', 'created', 'modified')])
     date = tzdatetime.new(date).utc
     meta = type(self)._meta
     return 'tag:%s,%s:/%s/%s/%d/%d' % (current_site.domain, date.strftime('%Y-%m-%d'), meta.app_label,
                                        meta.object_name.lower(), id, date.unixtime)
Exemplo n.º 3
0
 def get_best_url(self):
     """The URL you should actually use, prefers final redirection page, if it exists"""
     return first(self.resolved_url, self.url)
Exemplo n.º 4
0
 def get_best_url(self):
     """The URL you should actually use, prefers final redirection page, if it exists"""
     return first(self.resolved_url, self.url)