Commits

Guilherme Gondim committed 1ec68a0

take out ping and markuping support (must be implemented in diario.contrib)

Comments (0)

Files changed (2)

diario/signals.py

-# -*- coding: utf-8 -*-
-#
-#  Copyright (c) 2007-2012 Guilherme Gondim and contributors
-#
-#  This file is part of Django Diário.
-#
-#  Django Diário is free software under terms of the GNU Lesser
-#  General Public License version 3 (LGPLv3) as published by the Free
-#  Software Foundation. See the file README for copying conditions.
-#
-
-"""
-Signals relating to entries.
-"""
-
-from django.contrib.sites.models import Site
-from django.core.urlresolvers import reverse
-
-from diario.utils import ping_weblog_directory
-
-
-def ping_with_pingomatic(instance, created, **kwargs):
-    """
-    Updates multiple services and search engines about updates to
-    weblog content, with `ping-o-matic <http://pingomatic.com/>`_.
-
-    To connect this signal, you need use ``post_save``
-    method. Example::
-
-      signals.post_save.connect(ping_with_pingomatic, sender=Entry)
-
-    """
-    if created:
-        site = Site.objects.get_current()
-        site_url = 'http://%s' % site + reverse('diario-entry-list')
-        ping_weblog_directory(site.name, site_url, 'http://rpc.pingomatic.com/')

diario/utils.py

-# -*- coding: utf-8 -*-
-#
-#  Copyright (c) 2007-2012 Guilherme Gondim and contributors
-#
-#  This file is part of Django Diário.
-#
-#  Django Diário is free software under terms of the GNU Lesser
-#  General Public License version 3 (LGPLv3) as published by the Free
-#  Software Foundation. See the file README for copying conditions.
-#
-
-from xmlrpclib import ServerProxy
-
-def markuping(markup, value):
-    """
-    Transform plain text markup syntaxes to HTML with filters in
-    django.contrib.markup.templatetags.
-
-    *Required arguments:*
-
-        * ``markup``: 'markdown', 'rest' or 'texttile'. For any other string
-                    value is returned without modifications.
-        * ``value``: plain text input
-
-    """
-    if markup == 'markdown':
-        from markdown import markdown
-        return markdown(value)
-    elif markup == 'rest':
-        from django.contrib.markup.templatetags.markup import restructuredtext
-        return restructuredtext(value)
-    elif markup == 'textile':
-        from django.contrib.markup.templatetags.markup import textile
-        return textile(value)
-    else:
-        return value            # raw
-
-
-def ping_weblog_directory(site_name, site_url, server_url, fail_silently=True):
-    """
-    Ping weblog directory about weblog updates. Works with Technorati,
-    ping-o-matic and others.
-
-    *Required arguments:*
-
-        * ``site_name``: name of site/weblog.
-        * ``site_url``: site/weblog URL.
-        * ``server_url``: URL of XML-RPC server to ping.
-
-    *Optional arguments:*
-
-        * ``fail_silently``: if true, don't raises any exception when
-                           ping fails.
-
-    Note: In signals module you have a signal to ping ping-o-matic.
-    """
-    server = ServerProxy(server_url)
-    try:
-        return server.weblogUpdates.ping(site_name, site_url)
-    except Exception, e:
-        if fail_silently:
-            return
-        raise e
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.