Skip to content
This repository was archived by the owner on Jul 11, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/adhocracy/config/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,19 +468,22 @@ def make_map(config):
map.connect('/admin/treatment/{key}/assigned',
controller='treatment', action='assigned')

# TODO - fix these actions: index, make_new, edit, update;
# choose different URLs for edit, update
map.connect('/static{.format}', controller='static', action='index',
conditions=dict(method=['GET', 'HEAD']))
map.connect('/static{.format}', controller='static', action='make_new',
conditions=dict(method=['POST']))
map.connect('/static/new{.format}', controller='static', action='new')
map.connect('/static/{key}{.format}', controller='static',
action='serve')
map.connect('/static/{key}_{lang}',
controller='static', action='edit',
conditions=dict(method=['GET', 'HEAD']))
map.connect('/static/{key}_{lang}{.format}',
controller='static', action='update',
conditions=dict(method=['POST']))
map.connect('/static/{key}{.format}', controller='static',
action='serve')

map.connect('/outgoing_link/{url_enc}', controller='redirect',
action='outgoing_link',
conditions=dict(method=['GET', 'HEAD']))
Expand Down
8 changes: 4 additions & 4 deletions src/adhocracy/controllers/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NewForm(EditForm):
class StaticController(BaseController):

@guard_perms
def index(self):
def index(self, format=u'html'):
data = {
'static_pages': get_backend().all()
}
Expand All @@ -55,7 +55,7 @@ def new(self, errors=None, format=u'html'):

@guard_perms
@csrf.RequireInternalRequest(methods=['POST'])
def make_new(self):
def make_new(self, format=u'html'):
try:
form_result = NewForm().to_python(request.params)
except Invalid as i:
Expand Down Expand Up @@ -96,7 +96,7 @@ def edit(self, key, lang, errors=None, format=u'html'):

@guard_perms
@csrf.RequireInternalRequest(methods=['POST'])
def update(self, key, lang):
def update(self, key, lang, format=u'html'):
backend = get_backend()
sp = backend.get(key, lang)
if not sp:
Expand All @@ -114,7 +114,7 @@ def update(self, key, lang):
return redirect(helpers.base_url('/static'))

@guard.perm('static.show')
def serve(self, key, format='html'):
def serve(self, key, format=u'html'):
page = get_static_page(key)
if page is None:
return abort(404, _('The requested page was not found'))
Expand Down