~bryce/inkscape-web/projects-pages

« back to all changes in this revision

Viewing changes to debug_design/themer.py

  • Committer: Martin Owens
  • Date: 2016-03-07 05:43:23 UTC
  • Revision ID: doctormo@gmail.com-20160307054323-g0j5a0etdph2ahcx
Add experimental debug design toolbar, under heavy development but shouldn't effect live website

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Copyright 2016, Martin Owens <doctormo@gmail.com>
 
3
#
 
4
# This file is part of the software inkscape-web, consisting of custom
 
5
# code for the Inkscape project's django-based website.
 
6
#
 
7
# inkscape-web is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU Affero General Public License as published by
 
9
# the Free Software Foundation, either version 3 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# inkscape-web is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU Affero General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU Affero General Public License
 
18
# along with inkscape-web.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
"""
 
21
Provide a global request object.
 
22
"""
 
23
 
 
24
from .middleware import RequestMiddleware
 
25
 
 
26
def get_theme(default=None):
 
27
    """
 
28
    Try and return the current theme in use (usually person's username)
 
29
    """
 
30
    request = RequestMiddleware.get_request(None)
 
31
    if request is not None:
 
32
        if request.user.is_authenticated():
 
33
            return request.user.username
 
34
    return default
 
35