Ejemplo n.º 1
0
from pingback import register_pingback, ping_func
from pingback.client import ping_external_links, ping_directories
from django_xmlrpc import xmlrpcdispatcher

from blogango.models import BlogEntry


def pingback_blog_handler(year, month, slug, **kwargs):
    return BlogEntry.objects.get(created_on__year=year,
                                 created_on__month=month,
                                 slug=slug,
                                 is_published=True)


# ping_details = {'blogango_details': pingback_blog_handler}

register_pingback('blogango.views.details', pingback_blog_handler)

xmlrpcdispatcher.register_function(ping_func, 'pingback.ping')

# ping external links in the entry


def get_blog_text(instance):
    return instance.text.rendered


signals.post_save.connect(ping_external_links(content_func=get_blog_text,
                                              url_attr='get_absolute_url'),
                          sender=BlogEntry,
                          weak=False)
Ejemplo n.º 2
0
        self.watermarked = ImageFieldFile(self, self.watermarked, relate_path)
        super(Media, self).save(*args, **kwargs)

    def __unicode__(self):
        return _('<Media: %s, uploaded at %s>') % (self.title, self.date.strftime('%I:%M%p, %Y/%m/%d'))

    def get_thumb_url(self):
        try:
            return self.watermarked.url
        except:
            return self.image.url

    def get_logo_url(self):
        return self.image.url + '?width=' + self.LOGO_SIZE + '&height=' + self.LOGO_SIZE

from pingback.client import ping_external_links, ping_directories

signals.post_save.connect(
        ping_external_links(content_attr='content', url_attr='get_absolute_url'),
        sender=Post, weak=False)

#signals.post_save.connect(
#        ping_directories(content_attr='content', url_attr='get_absolute_url'),
#        sender=Post, weak=False)

def on_comment_save(sender, comment, *args, **kwargs):
    post = comment.object
    post.hit_comments()

comment_save.connect(on_comment_save)
Ejemplo n.º 3
0
from time import strptime

from django.core.urlresolvers import reverse
from django.db.models import signals

from pingback import register_pingback, ping_func
from pingback.client import ping_external_links, ping_directories
from django_xmlrpc import xmlrpcdispatcher

from blogango.models import BlogEntry


def pingback_blog_handler(year, month, slug, **kwargs):
    return BlogEntry.objects.get(created_on__year=year,
                                 created_on__month=month,
                                 slug=slug,
                                 is_published=True)


# ping_details = {'blogango_details': pingback_blog_handler}

register_pingback('blogango.views.details', pingback_blog_handler)

xmlrpcdispatcher.register_function(ping_func, 'pingback.ping')

# ping external links in the entry
signals.post_save.connect(ping_external_links(content_attr='text',
                                              url_attr='get_absolute_url'),
                          sender=BlogEntry,
                          weak=False)
Ejemplo n.º 4
0
from time import strptime

from django.core.urlresolvers import reverse
from django.db.models import signals

from pingback import register_pingback, ping_func
from pingback.client import ping_external_links, ping_directories
from django_xmlrpc import xmlrpcdispatcher

from blogango.models import BlogEntry

def pingback_blog_handler(year, month, slug, **kwargs):
    return BlogEntry.objects.get(created_on__year=year, 
                                 created_on__month=month, 
                                 slug=slug, 
                                 is_published=True)
    

# ping_details = {'blogango_details': pingback_blog_handler}

register_pingback('blogango.views.details', pingback_blog_handler)

xmlrpcdispatcher.register_function(ping_func, 'pingback.ping')

# ping external links in the entry

def get_blog_text(instance):
    return instance.text.rendered

signals.post_save.connect(ping_external_links(content_func=get_blog_text, url_attr='get_absolute_url'), sender=BlogEntry, weak=False)
Ejemplo n.º 5
0
from time import strptime

from django.core.urlresolvers import reverse
from django.db.models import signals

from pingback import register_pingback, ping_func
from pingback.client import ping_external_links, ping_directories
from django_xmlrpc import xmlrpcdispatcher

from blogango.models import BlogEntry

def pingback_blog_handler(year, month, slug, **kwargs):
    return BlogEntry.objects.get(created_on__year=year, 
                                 created_on__month=month, 
                                 slug=slug, 
                                 is_published=True)
    

# ping_details = {'blogango_details': pingback_blog_handler}

register_pingback('blogango.views.details', pingback_blog_handler)

xmlrpcdispatcher.register_function(ping_func, 'pingback.ping')

# ping external links in the entry

def get_blog_text(instance):
    return instance.text.rendered

signals.post_save.connect(ping_external_links(content_func=get_blog_text, url_attr='get_absolute_url'), sender=BlogEntry, weak=True)