forked from github/pelican
implemented github activity plugin
This commit is contained in:
parent
28c0644eb6
commit
c6c0ee76c2
3 changed files with 40 additions and 0 deletions
|
|
@ -222,3 +222,15 @@ def files_changed(path, extensions):
|
|||
LAST_MTIME = mtime
|
||||
return True
|
||||
return False
|
||||
|
||||
def singleton(cls):
|
||||
"""
|
||||
Singleton decorator for multiple calls inside plugins
|
||||
for an example see pelican/plugins/github_activity.py
|
||||
"""
|
||||
instances = {}
|
||||
def getinstance(*args, **kwargs):
|
||||
if cls not in instances:
|
||||
instances[cls] = cls(*args, **kwargs)
|
||||
return instances[cls]
|
||||
return getinstance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue