Add a few docstrings and update readme to-do list.
This commit is contained in:
parent
8f000543ea
commit
74f4e74bdf
3 changed files with 18 additions and 0 deletions
|
@ -50,6 +50,7 @@ If you are interested in helping, please raise an issue before making any pull r
|
|||
- Make the FFmpeg path configurable. Some kind of global config? Or part of the database config file? It's not like every photodb needs a separate one.
|
||||
- Improve the appearance of album page. Too many section headers and the "Create album" interface should allow giving a title immediately.
|
||||
- When users have '%' or '#', etc. in their username, it is difficult to access their /user/ URL. I would prefer to fix it without simply blacklisting those characters.
|
||||
- Currently, the Jinja templates are having a tangling influence on the backend objects, because Jinja cannot import my other modules like bytestring, but it can access the methods of the objects I pass into the template. As a result, the objects have excess helper methods. Consider making them into Jinja filters instead. Which is also kind of ugly but will move that pollution out of the backend at least.
|
||||
|
||||
### To do list: User permissions
|
||||
Here are some thoughts about the kinds of features that need to exist within the permission system. I don't know how I'll actually manage it just yet. Possibly a `permissions` table in the database with `user_id | permission` where `permission` is some reliably-formatted string.
|
||||
|
|
|
@ -12,6 +12,13 @@ def pascal_to_loudsnakes(text):
|
|||
|
||||
class ErrorTypeAdder(type):
|
||||
'''
|
||||
During definition, the Exception class will automatically receive a class
|
||||
attribute called `error_type` which is just the class's name as a string
|
||||
in the loudsnake casing style. NoSuchPhoto -> NO_SUCH_PHOTO.
|
||||
|
||||
This is used for serialization of the exception object and should
|
||||
basically act as a status code when displaying the error to the user.
|
||||
|
||||
Thanks Unutbu
|
||||
http://stackoverflow.com/a/18126678
|
||||
'''
|
||||
|
@ -20,6 +27,12 @@ class ErrorTypeAdder(type):
|
|||
cls.error_type = pascal_to_loudsnakes(name)
|
||||
|
||||
class EtiquetteException(Exception, metaclass=ErrorTypeAdder):
|
||||
'''
|
||||
Base type for all of the Etiquette exceptions.
|
||||
Subtypes should have a class attribute `error_message`. The error message
|
||||
may contain {format} strings which will be formatted using the
|
||||
Exception's constructor arguments.
|
||||
'''
|
||||
error_message = ''
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.given_args = args
|
||||
|
|
|
@ -325,6 +325,7 @@ class Album(ObjectBase, GroupableMixin):
|
|||
photos = self.walk_photos()
|
||||
else:
|
||||
photos = self.photos()
|
||||
|
||||
for photo in photos:
|
||||
photo.add_tag(tag, commit=False)
|
||||
|
||||
|
@ -499,6 +500,9 @@ class Bookmark(ObjectBase):
|
|||
@decorators.required_feature('bookmark.edit')
|
||||
@decorators.transaction
|
||||
def edit(self, title=None, url=None, *, commit=True):
|
||||
'''
|
||||
Change the title or URL. Leave None to keep current.
|
||||
'''
|
||||
if title is None and url is None:
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in a new issue