2017-10-24 21:31:08 -04:00
|
|
|
class Entry:
|
2017-10-27 01:51:46 -04:00
|
|
|
def __init__(self, id, plural, icon, slug=False):
|
2017-10-25 18:01:36 -04:00
|
|
|
self.id = id
|
|
|
|
self.plural = plural
|
|
|
|
self.icon = icon
|
2017-10-27 01:51:46 -04:00
|
|
|
self.slug = slug
|
2017-10-24 21:31:08 -04:00
|
|
|
|
2017-10-25 18:01:36 -04:00
|
|
|
@property
|
|
|
|
def index(self):
|
|
|
|
return self.plural + '_index'
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-10-25 18:01:36 -04:00
|
|
|
@property
|
|
|
|
def entry(self):
|
|
|
|
return self.plural + '_entry'
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-10-31 18:29:59 -04:00
|
|
|
@property
|
|
|
|
def atom(self):
|
|
|
|
return self.plural + '_atom'
|
|
|
|
|
|
|
|
@property
|
|
|
|
def rss(self):
|
|
|
|
return self.plural + '_rss'
|
|
|
|
|
2017-10-25 18:01:36 -04:00
|
|
|
|
|
|
|
Note = Entry(
|
|
|
|
id='note',
|
|
|
|
icon='fa fa-paper-plane',
|
|
|
|
plural='notes',
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
Article = Entry(
|
|
|
|
id='article',
|
|
|
|
icon='fa fa-file-text',
|
|
|
|
plural='articles',
|
2017-10-27 01:51:46 -04:00
|
|
|
slug=True,
|
2017-10-25 18:01:36 -04:00
|
|
|
)
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-10-27 01:04:05 -04:00
|
|
|
Photo = Entry(
|
|
|
|
id='photo',
|
|
|
|
icon='fa fa-camera',
|
|
|
|
plural='photos',
|
|
|
|
)
|
2017-10-24 21:01:52 -04:00
|
|
|
|
2017-10-27 01:04:05 -04:00
|
|
|
all = (Note, Article, Photo)
|
2017-10-24 21:01:52 -04:00
|
|
|
from_id = {k.id: k for k in all}
|
|
|
|
from_plural = {k.plural: k for k in all}
|