2
# Copyright 2016, Martin Owens <doctormo@gmail.com>
4
# This file is part of the software inkscape-web, consisting of custom
5
# code for the Inkscape project's django-based website.
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.
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.
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/>.
21
Provide a global request object.
24
from .middleware import RequestMiddleware
26
def get_theme(default=None):
28
Try and return the current theme in use (usually person's username)
30
request = RequestMiddleware.get_request(None)
31
if request is not None:
32
if request.user.is_authenticated():
33
return request.user.username