Commit b9963534 authored by Benjamin Graillot's avatar Benjamin Graillot

Gestion de la création et de la suppression de page

parent 819bc3f5
......@@ -24,9 +24,11 @@ class Information(Enum):
class Update(Enum):
edit = 0
rename = 1
attach = 2
delete_attach = 3
create = 1
remove = 2
rename = 3
attach = 4
delete_attach = 5
DEFAULT_SENDER = 'wiki@crans.org'
......@@ -45,6 +47,25 @@ UPDATES = {
]
),
Update.create: (
lambda **kwargs: '\x0310,99{page}\x0f \x033,99{user}\x0f \x0399,99{comment}\x0f \x0315,99(r1)'.format(**kwargs) if kwargs['comment']\
else '\x0310,99{page}\x0f \x033,99{user}\x0f \x0315,99(r1)\x0f'.format(**kwargs),
'page', [
(Information.required, ['page', 'user'], r'La page « (?P<page>.*) » a été modifiée par (?P<user>.*) :'),
(Information.required, [], r'\s*Nouvelle page :\n'),
(Information.optional, ['comment'], r'\s*Commentaire :\s*\n\s*(?P<comment>[^\n]*)\n')
]
),
Update.remove: (
lambda **kwargs: '\x0310,99{page}\x0f \x033,99{user}\x0f \x0399,99{comment}\x0f'.format(**kwargs) if kwargs['comment']\
else '\x0310,99{page}\x0f \x033,99{user}\x0f'.format(**kwargs),
'page', [
(Information.required, ['page', 'user'], r'La page « (?P<page>.*) » a été supprimée par (?P<user>.*) :'),
(Information.optional, ['comment'], r'\s*Commentaire :\s*\n\s*(?P<comment>[^\n]*)\n')
]
),
Update.rename: (
lambda **kwargs: '\x0310,99{page}\x0f \x033,99{user}\x0f \x0399,99rename -->\x0f \x0310,99{new}\x0f \x0399,99{comment}\x0f'.format(**kwargs) if kwargs['comment']\
else '\x0310,99{page}\x0f \x033,99{user}\x0f \x0399,99rename -->\x0f \x0310,99{new}\x0f'.format(**kwargs),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment