File diff 8d48feb4c630 → 4ceb4b4ae2e2
www/conservancy/apps/news/models.py
Show inline comments
...
 
@@ -31,49 +31,49 @@ class PressRelease(models.Model, bsoup.SoupModelMixin):
 
    SOUP_ATTRS = ['summary', 'body']
 

	
 
    def __str__(self):
 
        return self.headline
 

	
 
    def get_absolute_url(self):
 
        return u"/news/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(),
 
                                  self.slug)
 

	
 
    def is_recent(self):
 
        return self.pub_date > (datetime.now() - timedelta(days=5))
 
        # question: does datetime.now() do a syscall each time is it called?
 

	
 
    def is_in_past_month(self):
 
        # This function is deprecated.  Use the date_within template
 
        # filter instead (example in conservancy/templates/frontpage.html)
 
        return self.pub_date > (datetime.now() - timedelta(days=30))
 

	
 
    def save(self):
 
        if settings.CONSERVANCY_DEVEL or True:
 
            super(PressRelease, self).save()
 
            return
 

	
 
        blog_name = 'Software Freedom Conservancy News'
 
        blog_url =  'https://www.sfconservancy.org/news/'
 
        blog_url = 'https://www.sfconservancy.org/news/'
 
        post_url = ('https://www.sfconservancy.org'
 
                    + self.get_absolute_url())
 

	
 
        import xmlrpc.client
 

	
 
        # Ping Technorati
 
        j = xmlrpc.client.Server('http://rpc.technorati.com/rpc/ping')
 
        reply = j.weblogUpdates.ping(blog_name, blog_url)
 

	
 
        # Ping Google Blog Search
 
        j = xmlrpc.client.Server('http://blogsearch.google.com/ping/RPC2')
 
        reply = j.weblogUpdates.ping(blog_name, blog_url, post_url)
 

	
 
        # Call any superclass's method
 
        super(PressRelease, self).save()
 

	
 
class ExternalArticleTag(models.Model):
 
    """A way to tag external articles"""
 

	
 
    label = models.CharField(max_length=100)
 

	
 
    date_created = models.DateField(auto_now_add=True)
 

	
 
    def __str__(self):