My favorites | Sign in
Project Home Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import re
from google.appengine.api import urlfetch

"""Plugin infrastructure based on Marty Alchin's post at
http://gulopine.gamemusic.org/2008/jan/10/simple-plugin-framework/
"""
class ProviderMount(type):
def __init__(cls, name, bases, attrs):
if not hasattr(cls, 'plugins'):
cls.plugins = []
else:
cls.plugins.append(cls)

def get_providers(self, *args, **kwargs):
return [p(*args, **kwargs) for p in self.plugins]

class Provider(object):
"""
Mount point for plugins which refer to actions that can be performed.
Plugins implementing this reference should provide the following attributes:
======== ========================================================
title the site/api for which this provider works
url friendly url description - ombed.com's configuration URL scheme
url_re the regex pattern for the URLs which the provider works for
example_url An exemplary URL that this provider should be able to work with
======== ========================================================

With the provided url_re, this class' constructor will create a
class attribute named `url_regex`.
"""
__metaclass__ = ProviderMount

def __init__(self):
self.__class__.url_regex = re.compile(self.__class__.url_re, re.I|re.UNICODE)

Change log

10e9df6706bf by Deepak Sarda <dee...@antrix.net> on Nov 19, 2010   Diff
New configuration driven provider for
oembed endpoints
Go to: 
Sign in to write a code review

Older revisions

19ab93e11923 by Deepak Sarda <dee...@antrix.net> on Jul 25, 2009   Diff
Refactoring for better error
propagation to client
ae09c1e0df7e by Deepak Sarda <dee...@antrix.net> on Jul 17, 2009   Diff
Initial repo conversion to mercurial
All revisions of this file

File info

Size: 1358 bytes, 35 lines
Powered by Google Project Hosting