Skip to content

Commit

Permalink
[#2494] Add a new API endpoint to set timezone offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Oderbolz committed Jun 30, 2015
1 parent 88218c2 commit ec775ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions ckan/config/routing.py
Expand Up @@ -443,6 +443,7 @@ def make_map():

with SubMapper(map, controller='util') as m:
m.connect('/i18n/strings_{lang}.js', action='i18n_js_strings')
m.connect('/util/set_timezone_offset/{offset}', action='set_timezone_offset')
m.connect('/util/redirect', action='redirect')
m.connect('/testing/primer', action='primer')
m.connect('/testing/markup', action='markup')
Expand Down
8 changes: 7 additions & 1 deletion ckan/controllers/util.py
Expand Up @@ -3,7 +3,7 @@
import ckan.lib.base as base
import ckan.lib.i18n as i18n
import ckan.lib.helpers as h
from ckan.common import _
from ckan.common import _, request


class UtilController(base.BaseController):
Expand All @@ -25,6 +25,12 @@ def primer(self):
This is useful for development/styling of ckan. '''
return base.render('development/primer.html')

def set_timezone_offset(self, offset):
session = request.environ['beaker.session']
session['utc_offset_mins'] = offset
session.save()
return session.get('utc_offset_mins', 'No offset set')

def markup(self):
''' Render all html elements out onto a single page.
This is useful for development/styling of ckan. '''
Expand Down

0 comments on commit ec775ed

Please sign in to comment.