Merge lp:~widelands-dev/widelands-website/mv_main_files into lp:widelands-website

Proposed by kaputtnik
Status: Merged
Merged at revision: 531
Proposed branch: lp:~widelands-dev/widelands-website/mv_main_files
Merge into: lp:widelands-website
Diff against target: 1003 lines (+139/-140)
34 files modified
README.txt (+43/-39)
mainpage/settings.py (+3/-3)
mainpage/sitemap_urls.py (+1/-2)
mainpage/templatetags/wl_markdown.py (+9/-9)
mainpage/urls.py (+2/-2)
mainpage/utest/test_wl_markdown.py (+2/-2)
mainpage/views.py (+6/-6)
mainpage/wlwebsite_wsgi.py (+1/-1)
manage.py (+1/-1)
news/models.py (+0/-1)
privacy_policy/views.py (+1/-1)
threadedcomments/views.py (+1/-1)
widelandslib/make_flow_diagram.py (+2/-2)
widelandslib/tribe.py (+3/-3)
wiki/forms.py (+3/-2)
wiki/templates/wiki/backlinks.html (+2/-1)
wiki/urls.py (+13/-13)
wiki/views.py (+2/-2)
wlggz/migrations/0001_initial.py (+1/-1)
wlggz/models.py (+1/-3)
wlhelp/management/commands/update_help.py (+12/-12)
wlhelp/management/commands/update_help_pdf.py (+5/-5)
wlhelp/views.py (+0/-2)
wlimages/models.py (+2/-2)
wlmaps/forms.py (+4/-5)
wlmaps/tests/test_views.py (+0/-2)
wlmaps/views.py (+4/-3)
wlprofile/forms.py (+1/-1)
wlprofile/migrations/0001_initial.py (+1/-1)
wlprofile/models.py (+2/-2)
wlprofile/templatetags/custom_date.py (+3/-3)
wlscheduling/templates/wlscheduling/other-users.html (+3/-2)
wlscreens/models.py (+3/-3)
wlscreens/tests/test_models.py (+2/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands-website/mv_main_files
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+365634@code.launchpad.net

Commit message

Moved main files into folder mainpage

Description of the change

Python3 is more restrictive with relative imports. Moving the mainfiles into the directory 'mainpage' is made to perform this.

In python terms: The folder widelands (containing manage.py) will no longer be a 'package'. Running manage.py will call anything inside the package 'mainpage' and thus relative imports will work again.

This reflects also the initial structure of a django project, like shown here: https://docs.djangoproject.com/en/2.2/intro/reusable-apps/#your-project-and-your-reusable-app

Running the 2to3 script (for porting python2 to python3 code) produces less faulty code in regard to imports after this change.

I have also moved the privacy template to his origin (privacy_policy).

Should be tested on alpha.

To post a comment you must log in.
534. By kaputtnik

removed superfluous comment

Revision history for this message
kaputtnik (franku) wrote :

Looks like it works fine on alpha.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Tested and working :)

Just 1 small nit for the English language.

review: Approve
535. By kaputtnik

addressed code review; fixed missing static templatetags

Revision history for this message
kaputtnik (franku) wrote :

Thanks, all fixed, also the smiley thing(s).

I'll do the merge eventually this evening.

Revision history for this message
kaputtnik (franku) wrote :

This is merged and deployed. Now we can definitely work on porting to python3 :)

I had to change the init-file to let gunicorn find the moved file wlwebsite_wsgi.py

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README.txt'
--- README.txt 2018-12-30 11:45:03 +0000
+++ README.txt 2019-04-08 05:56:42 +0000
@@ -57,6 +57,7 @@
5757
58This will take a while. If no errors are shown we should be fine.58This will take a while. If no errors are shown we should be fine.
5959
60
60Setting up the website61Setting up the website
61======================62======================
6263
@@ -68,8 +69,8 @@
68those files and modify them to your needs - most likely everything works69those files and modify them to your needs - most likely everything works
69directly, but you might want to edit the bd variable in local_settings.py::70directly, but you might want to edit the bd variable in local_settings.py::
7071
71 $ ln -s local_urls.py.sample local_urls.py72 $ ln -s local_urls.py.sample mainpage/local_urls.py
72 $ ln -s local_settings.py.sample local_settings.py73 $ ln -s local_settings.py.sample mainpage/local_settings.py
7374
74Setting up the database75Setting up the database
75-----------------------76-----------------------
@@ -125,60 +126,63 @@
125See also https://docs.djangoproject.com/en/dev/ref/django-admin/#examples-of-using-different-ports-and-addresses126See also https://docs.djangoproject.com/en/dev/ref/django-admin/#examples-of-using-different-ports-and-addresses
126for further details.127for further details.
127128
129
128Dependencies between website and widelands source code130Dependencies between website and widelands source code
129======================================================131======================================================
130132
131Some parts of the website need access to the source code of widelands:133Some parts of the website need access to the source code of widelands, other
132134parts need some widelands executables.
133* Online help/Encyclopedia135
134* Possibility to upload a map onto the local website136Source code only
135* Source code documentation137----------------
136138
137You will need the widelands source code for this, see139The documentation is made out of the source code. To get a copy, see:
138140
139https://wl.widelands.org/wiki/BzrPrimer/141https://wl.widelands.org/wiki/BzrPrimer/
140142
141After the source code is downloaded, adjust the path of 143After the source code is downloaded, adjust the path of
142144
143WIDELANDS_SVN_DIR145WIDELANDS_SVN_DIR = '/path/to/widelands/trunk'
144146
145in local_settings.py to the path where the widelands source code is found.147in mainpage/local_settings.py to the path where the widelands source code can be
146148found. Then run:
147Setting up the online help / encyclopedia149
148-----------------------------------------150 $ ./manage.py create_docs
149151
150You will need graphviz to generate the graphs for the online help. On Ubuntu run:152After finishing without errors, type localhost:8000/documentation/index.html
153in your browsers addressbar or click on "Development -> Documentation".
154
155Widelands executables
156---------------------
157
158Widelands executables are needed to:
159
160* Upload maps to the website
161* Create the Encylopdia
162
163Either install widelands as a program to your operating system, or create the
164binaries by compiling the source code. If you want to compile, run:
165
166 $ ./compile.sh -r
167
168inside of the WIDELANDS_SVN_DIR to create a release build.
169
170Uploading maps should work now.
171
172Creating the encyclopdia needs graphviz to generate the graphs. On Ubuntu run:
151173
152 $ sudo apt-get install graphviz174 $ sudo apt-get install graphviz
153175
154To generate the online help database switch to your local environment and run:176To generate the online help switch to your local environment and run:
155177
156 $ ./manage.py update_help178 $ ./manage.py update_help
157179
158After that you can create the overview pdf files with180Now you can create the economy graphs:
159181
160 $ ./manage.py update_help_pdf182 $ ./manage.py update_help_pdf
161183
162Setting up widelands source code documentation184You can access the encyclopdia by clicking on 'The Game -> Encyclopedia' now.
163----------------------------------------------185
164
165There is a small helper script to get the documenation. Be sure
166you have set WIDELANDS_SVN_DIR set in local_settings.py. Run:
167
168 $ ./manage.py create_docs
169
170After finishing without errors, type localhost:8000/documentation/index.html
171in your browsers addressbar or click on "Development -> Documentation".
172
173
174Uploading a map to the local website
175------------------------------------
176
177Compile the widelands binaries by using the compile.sh script
178
179 $ ./compile.sh
180
181Now you should be able to upload a map onto your local website.
182186
183Contact187Contact
184=======188=======
185189
=== removed file '__init__.py'
=== renamed file 'mainpage/urls.py' => 'mainpage/mainpage_urls.py'
=== renamed file 'online_users_middleware.py' => 'mainpage/online_users_middleware.py'
=== renamed file 'settings.py' => 'mainpage/settings.py'
--- settings.py 2019-03-04 17:53:53 +0000
+++ mainpage/settings.py 2019-04-08 05:56:42 +0000
@@ -3,7 +3,7 @@
3# Build paths inside the project like this: os.path.join(BASE_DIR, ...)3# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
4import os4import os
55
6BASE_DIR = os.path.dirname(os.path.abspath(__file__))6BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
7DEBUG = True7DEBUG = True
88
9ADMINS = (9ADMINS = (
@@ -68,7 +68,7 @@
68# Make this unique, and don't share it with anybody.68# Make this unique, and don't share it with anybody.
69SECRET_KEY = '#*bc7*q0-br42fc&6l^x@zzk&(=-#gr!)fn@t30n54n05jkqcu'69SECRET_KEY = '#*bc7*q0-br42fc&6l^x@zzk&(=-#gr!)fn@t30n54n05jkqcu'
7070
71ROOT_URLCONF = 'urls'71ROOT_URLCONF = 'mainpage.urls'
7272
73# List of finder classes that know how to find static files in73# List of finder classes that know how to find static files in
74# various locations.74# various locations.
@@ -132,7 +132,7 @@
132 132
133 # Foreign middleware133 # Foreign middleware
134 'dj_pagination.middleware.PaginationMiddleware',134 'dj_pagination.middleware.PaginationMiddleware',
135 'online_users_middleware.OnlineNowMiddleware',135 'mainpage.online_users_middleware.OnlineNowMiddleware',
136]136]
137137
138TEMPLATES = [138TEMPLATES = [
139139
=== renamed file 'sitemap_urls.py' => 'mainpage/sitemap_urls.py'
--- sitemap_urls.py 2018-03-21 21:10:46 +0000
+++ mainpage/sitemap_urls.py 2019-04-08 05:56:42 +0000
@@ -1,6 +1,5 @@
1from django.conf.urls import *1from django.conf.urls import url
22
3from mainpage.views import mainpage
4from django.contrib.sitemaps.views import sitemap3from django.contrib.sitemaps.views import sitemap
5from static_sitemap import StaticViewSitemap4from static_sitemap import StaticViewSitemap
6from wiki.sitemap import *5from wiki.sitemap import *
76
=== renamed file 'static_sitemap.py' => 'mainpage/static_sitemap.py'
=== modified file 'mainpage/templatetags/wl_markdown.py'
--- mainpage/templatetags/wl_markdown.py 2018-11-30 14:31:47 +0000
+++ mainpage/templatetags/wl_markdown.py 2019-04-08 05:56:42 +0000
@@ -13,7 +13,7 @@
13from django.conf import settings13from django.conf import settings
14from django.utils.encoding import smart_str, force_unicode14from django.utils.encoding import smart_str, force_unicode
15from django.utils.safestring import mark_safe15from django.utils.safestring import mark_safe
16from settings import BLEACH_ALLOWED_TAGS, BLEACH_ALLOWED_ATTRIBUTES16from django.conf import settings
17from markdownextensions.semanticwikilinks.mdx_semanticwikilinks import SemanticWikiLinkExtension17from markdownextensions.semanticwikilinks.mdx_semanticwikilinks import SemanticWikiLinkExtension
1818
19# Try to get a not so fully broken markdown module19# Try to get a not so fully broken markdown module
@@ -38,17 +38,17 @@
3838
39# We will also need the site domain39# We will also need the site domain
40from django.contrib.sites.models import Site40from django.contrib.sites.models import Site
41from settings import SITE_ID, SMILEYS, SMILEY_DIR41from django.conf import settings
4242
43try:43try:
44 _domain = Site.objects.get(pk=SITE_ID).domain44 _domain = Site.objects.get(pk=settings.SITE_ID).domain
45except:45except:
46 _domain = ''46 _domain = ''
4747
48# Getting local domain lists48# Getting local domain lists
49try:49try:
50 from settings import LOCAL_DOMAINS as _LOCAL_DOMAINS50 from django.conf import settings
51 LOCAL_DOMAINS = [_domain] + _LOCAL_DOMAINS51 LOCAL_DOMAINS = [_domain] + settings.LOCAL_DOMAINS
52except ImportError:52except ImportError:
53 LOCAL_DOMAINS = [_domain]53 LOCAL_DOMAINS = [_domain]
5454
@@ -76,12 +76,12 @@
7676
77 for i, word in enumerate(words):77 for i, word in enumerate(words):
78 smiley = ''78 smiley = ''
79 for sc, img in SMILEYS:79 for sc, img in settings.SMILEYS:
80 if word == sc:80 if word == sc:
81 smiley = img81 smiley = img
82 if smiley:82 if smiley:
83 img_tag = BeautifulSoup(features='lxml').new_tag('img')83 img_tag = BeautifulSoup(features='lxml').new_tag('img')
84 img_tag['src'] = '{}{}'.format(SMILEY_DIR, smiley)84 img_tag['src'] = '{}{}'.format(settings.SMILEY_DIR, smiley)
85 img_tag['alt'] = smiley85 img_tag['alt'] = smiley
86 tmp_content.append(img_tag)86 tmp_content.append(img_tag)
87 # apply a space after the smiley87 # apply a space after the smiley
@@ -204,7 +204,7 @@
204 if bs4_string.parent.name.lower() == 'code':204 if bs4_string.parent.name.lower() == 'code':
205 return False205 return False
206206
207 for sc in SMILEYS:207 for sc in settings.SMILEYS:
208 if sc[0] in bs4_string:208 if sc[0] in bs4_string:
209 return True209 return True
210 return False210 return False
@@ -223,7 +223,7 @@
223 # Sanitize posts from potencial untrusted users (Forum/Wiki/Maps)223 # Sanitize posts from potencial untrusted users (Forum/Wiki/Maps)
224 if 'bleachit' in args:224 if 'bleachit' in args:
225 html = mark_safe(bleach.clean(225 html = mark_safe(bleach.clean(
226 html, tags=BLEACH_ALLOWED_TAGS, attributes=BLEACH_ALLOWED_ATTRIBUTES))226 html, tags=settings.BLEACH_ALLOWED_TAGS, attributes=settings.BLEACH_ALLOWED_ATTRIBUTES))
227227
228 # Prepare the html and apply smileys and classes.228 # Prepare the html and apply smileys and classes.
229 # BeautifulSoup objects are all references, so changing a variable229 # BeautifulSoup objects are all references, so changing a variable
230230
=== renamed file 'urls.py' => 'mainpage/urls.py'
--- urls.py 2019-03-16 10:11:05 +0000
+++ mainpage/urls.py 2019-04-08 05:56:42 +0000
@@ -13,7 +13,7 @@
1313
14urlpatterns = [14urlpatterns = [
15 # Creating a sitemap.xml15 # Creating a sitemap.xml
16 url(r'^sitemap\.xml/', include('sitemap_urls')),16 url(r'^sitemap\.xml/', include('mainpage.sitemap_urls')),
17 # Static view of robots.txt17 # Static view of robots.txt
18 url(r'^robots\.txt/', TemplateView.as_view(template_name='robots.txt', content_type="text/plain")),18 url(r'^robots\.txt/', TemplateView.as_view(template_name='robots.txt', content_type="text/plain")),
1919
@@ -45,7 +45,7 @@
45 url(r'^forum/', include('pybb.urls')),45 url(r'^forum/', include('pybb.urls')),
4646
47 # WL specific:47 # WL specific:
48 url(r'^', include('mainpage.urls')),48 url(r'^', include('mainpage.mainpage_urls')),
49 url(r'^help/(?P<path>.*)', RedirectView.as_view(url='/encyclopedia/%(path)s',49 url(r'^help/(?P<path>.*)', RedirectView.as_view(url='/encyclopedia/%(path)s',
50 permanent=True)), # to not break old links50 permanent=True)), # to not break old links
51 url(r'^encyclopedia/', include('wlhelp.urls')),51 url(r'^encyclopedia/', include('wlhelp.urls')),
5252
=== modified file 'mainpage/utest/test_wl_markdown.py'
--- mainpage/utest/test_wl_markdown.py 2016-12-13 18:28:51 +0000
+++ mainpage/utest/test_wl_markdown.py 2019-04-08 05:56:42 +0000
@@ -17,9 +17,9 @@
17import unittest17import unittest
18from wiki.models import Article18from wiki.models import Article
19from django.contrib.sites.models import Site19from django.contrib.sites.models import Site
20from settings import SITE_ID20from django.conf import settings
21from django.test import TestCase as DBTestCase21from django.test import TestCase as DBTestCase
22_domain = Site.objects.get(pk=SITE_ID).domain22_domain = Site.objects.get(pk=settings.SITE_ID).domain
2323
24from templatetags.wl_markdown import do_wl_markdown24from templatetags.wl_markdown import do_wl_markdown
2525
2626
=== modified file 'mainpage/views.py'
--- mainpage/views.py 2019-02-09 14:50:47 +0000
+++ mainpage/views.py 2019-04-08 05:56:42 +0000
@@ -1,4 +1,4 @@
1from settings import WIDELANDS_SVN_DIR, INQUIRY_RECIPIENTS1from django.conf import settings
2from templatetags.wl_markdown import do_wl_markdown2from templatetags.wl_markdown import do_wl_markdown
3from operator import itemgetter3from operator import itemgetter
4from django.core.mail import send_mail4from django.core.mail import send_mail
@@ -33,7 +33,7 @@
3333
34 # get email addresses which are in form of ('name','email'),34 # get email addresses which are in form of ('name','email'),
35 recipients = []35 recipients = []
36 for recipient in INQUIRY_RECIPIENTS:36 for recipient in settings.INQUIRY_RECIPIENTS:
37 recipients.append(recipient[1])37 recipients.append(recipient[1])
3838
39 send_mail(subject, message, sender,39 send_mail(subject, message, sender,
@@ -46,7 +46,7 @@
4646
47 return render(request, 'mainpage/legal_notice.html', {47 return render(request, 'mainpage/legal_notice.html', {
48 'form': form,48 'form': form,
49 'inquiry_recipients': INQUIRY_RECIPIENTS,49 'inquiry_recipients': settings.INQUIRY_RECIPIENTS,
50 })50 })
5151
5252
@@ -67,7 +67,7 @@
67 txt = '[TOC]\n\n'67 txt = '[TOC]\n\n'
68 transl_files = []68 transl_files = []
69 transl_list = []69 transl_list = []
70 path = os.path.normpath(WIDELANDS_SVN_DIR + 'data/i18n/locales/')70 path = os.path.normpath(settings.WIDELANDS_SVN_DIR + 'data/i18n/locales/')
71 try:71 try:
72 transl_files = os.listdir(path)72 transl_files = os.listdir(path)
73 if transl_files:73 if transl_files:
@@ -100,7 +100,7 @@
100 # Get other developers, put in the translators list100 # Get other developers, put in the translators list
101 # at given position and prepare all for wl_markdown101 # at given position and prepare all for wl_markdown
102 try:102 try:
103 with open(WIDELANDS_SVN_DIR + 'data/txts/developers.json', 'r') as f:103 with open(settings.WIDELANDS_SVN_DIR + 'data/txts/developers.json', 'r') as f:
104 json_data = json.load(f)['developers']104 json_data = json.load(f)['developers']
105105
106 for head in json_data:106 for head in json_data:
@@ -145,7 +145,7 @@
145 This replaces the wiki changelog145 This replaces the wiki changelog
146146
147 """147 """
148 data = codecs.open(WIDELANDS_SVN_DIR + 'ChangeLog', encoding='utf-8', mode='r').read()148 data = codecs.open(settings.WIDELANDS_SVN_DIR + 'ChangeLog', encoding='utf-8', mode='r').read()
149 return render(request, 'mainpage/changelog.html',149 return render(request, 'mainpage/changelog.html',
150 {'changelog': data},150 {'changelog': data},
151 )151 )
152152
=== renamed file 'wl_utils.py' => 'mainpage/wl_utils.py'
=== renamed file 'wlwebsite_wsgi.py' => 'mainpage/wlwebsite_wsgi.py'
--- wlwebsite_wsgi.py 2016-12-13 18:28:51 +0000
+++ mainpage/wlwebsite_wsgi.py 2019-04-08 05:56:42 +0000
@@ -22,7 +22,7 @@
22sys.path.append(code_directory)22sys.path.append(code_directory)
23sys.path.append(os.path.join(code_directory, 'widelands'))23sys.path.append(os.path.join(code_directory, 'widelands'))
2424
25os.environ['DJANGO_SETTINGS_MODULE'] = 'widelands.settings'25os.environ['DJANGO_SETTINGS_MODULE'] = 'mainpage.settings'
2626
27if os.path.exists('/usr/games'):27if os.path.exists('/usr/games'):
28 os.environ['PATH'] += ':/usr/games'28 os.environ['PATH'] += ':/usr/games'
2929
=== modified file 'manage.py'
--- manage.py 2016-12-13 18:28:51 +0000
+++ manage.py 2019-04-08 05:56:42 +0000
@@ -3,7 +3,7 @@
3import sys3import sys
44
5if __name__ == '__main__':5if __name__ == '__main__':
6 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')6 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mainpage.settings')
77
8 from django.core.management import execute_from_command_line8 from django.core.management import execute_from_command_line
99
1010
=== modified file 'news/models.py'
--- news/models.py 2018-04-08 14:40:17 +0000
+++ news/models.py 2019-04-08 05:56:42 +0000
@@ -6,7 +6,6 @@
6from news.managers import PublicManager6from news.managers import PublicManager
7from django.urls import reverse7from django.urls import reverse
8import datetime8import datetime
9import settings
10import tagging9import tagging
1110
1211
1312
=== added directory 'privacy_policy/templates'
=== added directory 'privacy_policy/templates/privacy_policy'
=== renamed file 'mainpage/templates/mainpage/privacy_policy.html' => 'privacy_policy/templates/privacy_policy/privacy_policy.html'
=== modified file 'privacy_policy/views.py'
--- privacy_policy/views.py 2019-02-09 19:57:06 +0000
+++ privacy_policy/views.py 2019-04-08 05:56:42 +0000
@@ -43,4 +43,4 @@
43 'cur_lang': current_lang,43 'cur_lang': current_lang,
44 }44 }
4545
46 return render(request, 'mainpage/privacy_policy.html', context)46 return render(request, 'privacy_policy/privacy_policy.html', context)
4747
=== modified file 'threadedcomments/views.py'
--- threadedcomments/views.py 2018-10-10 18:02:55 +0000
+++ threadedcomments/views.py 2019-04-08 05:56:42 +0000
@@ -8,7 +8,7 @@
8from threadedcomments.forms import ThreadedCommentForm8from threadedcomments.forms import ThreadedCommentForm
9from threadedcomments.models import ThreadedComment, DEFAULT_MAX_COMMENT_LENGTH9from threadedcomments.models import ThreadedComment, DEFAULT_MAX_COMMENT_LENGTH
10from threadedcomments.utils import JSONResponse, XMLResponse10from threadedcomments.utils import JSONResponse, XMLResponse
11from wl_utils import get_real_ip11from mainpage.wl_utils import get_real_ip
1212
1313
14def _adjust_max_comment_length(form, field_name='comment'):14def _adjust_max_comment_length(form, field_name='comment'):
1515
=== modified file 'widelandslib/make_flow_diagram.py'
--- widelandslib/make_flow_diagram.py 2016-12-13 18:28:51 +0000
+++ widelandslib/make_flow_diagram.py 2019-04-08 05:56:42 +0000
@@ -3,7 +3,7 @@
33
4import pydot as d4import pydot as d
55
6from settings import MEDIA_ROOT6from django.conf import settings
7from widelandslib.tribe import *7from widelandslib.tribe import *
88
9from os import makedirs, path9from os import makedirs, path
@@ -182,7 +182,7 @@
182 global tdir182 global tdir
183 tdir = mkdtemp(prefix='widelands-help')183 tdir = mkdtemp(prefix='widelands-help')
184184
185 json_directory = path.normpath(MEDIA_ROOT + '/map_object_info')185 json_directory = path.normpath(settings.MEDIA_ROOT + '/map_object_info')
186 tribeinfo_file = open(path.normpath(186 tribeinfo_file = open(path.normpath(
187 json_directory + '/tribe_' + tribe_name + '.json'), 'r')187 json_directory + '/tribe_' + tribe_name + '.json'), 'r')
188 tribeinfo = json.load(tribeinfo_file)188 tribeinfo = json.load(tribeinfo_file)
189189
=== modified file 'widelandslib/tribe.py'
--- widelandslib/tribe.py 2016-12-13 18:28:51 +0000
+++ widelandslib/tribe.py 2019-04-08 05:56:42 +0000
@@ -4,8 +4,8 @@
4import os.path as p4import os.path as p
5import json5import json
6try:6try:
7 from settings import WIDELANDS_SVN_DIR7 from django.conf import settings
8 basedir = WIDELANDS_SVN_DIR8 basedir = settings.WIDELANDS_SVN_DIR
9except:9except:
10 basedir = p.join(p.dirname(__file__), p.pardir, p.pardir)10 basedir = p.join(p.dirname(__file__), p.pardir, p.pardir)
1111
@@ -20,7 +20,7 @@
2020
21 @property21 @property
22 def image(self):22 def image(self):
23 return p.abspath(p.join(WIDELANDS_SVN_DIR, 'data', self._json['icon']))23 return p.abspath(p.join(settings.WIDELANDS_SVN_DIR, 'data', self._json['icon']))
2424
2525
26class Ware(BaseDescr):26class Ware(BaseDescr):
2727
=== renamed file 'diff_match_patch.py' => 'wiki/diff_match_patch.py'
=== modified file 'wiki/forms.py'
--- wiki/forms.py 2018-09-18 06:42:18 +0000
+++ wiki/forms.py 2019-04-08 05:56:42 +0000
@@ -7,14 +7,15 @@
77
8from wiki.models import Article8from wiki.models import Article
9from wiki.models import ChangeSet9from wiki.models import ChangeSet
10from settings import WIKI_WORD_RE10from django.conf import settings
11
11try:12try:
12 from notification import models as notification13 from notification import models as notification
13except:14except:
14 notification = None15 notification = None
1516
1617
17wikiword_pattern = re.compile('^' + WIKI_WORD_RE + '$')18wikiword_pattern = re.compile('^' + settings.WIKI_WORD_RE + '$')
1819
1920
20class ArticleForm(forms.ModelForm):21class ArticleForm(forms.ModelForm):
2122
=== modified file 'wiki/templates/wiki/backlinks.html'
--- wiki/templates/wiki/backlinks.html 2018-06-03 15:33:37 +0000
+++ wiki/templates/wiki/backlinks.html 2019-04-08 05:56:42 +0000
@@ -1,6 +1,7 @@
1{% extends 'wiki/base.html' %}1{% extends 'wiki/base.html' %}
2{% load wiki_extras %}2{% load wiki_extras %}
3{% load i18n %}3{% load i18n %}
4{% load static %}
45
5{% block title %}6{% block title %}
6{{ name }} - Backlinks - {{block.super}}7{{ name }} - Backlinks - {{block.super}}
@@ -36,7 +37,7 @@
36 {% endif %}37 {% endif %}
37 {% else %}38 {% else %}
38 <p><span class="errormessage">Every Wikipage must be linked from at least one another page.</span>39 <p><span class="errormessage">Every Wikipage must be linked from at least one another page.</span>
39 Please link it <img src="/wlmedia/img/smileys/face-smile.png" alt="face-smile.png"> See <a href="/wiki/WikiSyntax/#links">Wiki Syntax</a> for help.</p></p>40 Please link it <img src="{% static 'img/smileys/face-smile.png' %}" alt="face-smile.png"> See <a href="/wiki/WikiSyntax/#links">Wiki Syntax</a> for help.</p></p>
40 {% endif %}41 {% endif %}
41</div>42</div>
42{% endblock %}43{% endblock %}
4344
=== modified file 'wiki/urls.py'
--- wiki/urls.py 2017-02-24 20:12:28 +0000
+++ wiki/urls.py 2019-04-08 05:56:42 +0000
@@ -3,7 +3,7 @@
3from django.conf.urls import *3from django.conf.urls import *
4from django.http import HttpResponseRedirect4from django.http import HttpResponseRedirect
5from wiki import views, models5from wiki import views, models
6from settings import WIKI_URL_RE6from django.conf import settings
7from django.views.generic import RedirectView7from django.views.generic import RedirectView
8from wiki.feeds import RssHistoryFeed, AtomHistoryFeed, RssArticleHistoryFeed, AtomArticleHistoryFeed8from wiki.feeds import RssHistoryFeed, AtomHistoryFeed, RssArticleHistoryFeed, AtomArticleHistoryFeed
99
@@ -25,38 +25,38 @@
25 # Feeds25 # Feeds
26 url(r'^feeds/rss/$', RssHistoryFeed(), name='wiki_history_feed_rss'),26 url(r'^feeds/rss/$', RssHistoryFeed(), name='wiki_history_feed_rss'),
27 url(r'^feeds/atom/$', AtomHistoryFeed(), name='wiki_history_feed_atom'),27 url(r'^feeds/atom/$', AtomHistoryFeed(), name='wiki_history_feed_atom'),
28 url(r'^(?P<title>' + WIKI_URL_RE + r')/feeds/rss/$', RssArticleHistoryFeed(),28 url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/feeds/rss/$', RssArticleHistoryFeed(),
29 name='wiki_article_history_feed_rss'),29 name='wiki_article_history_feed_rss'),
30 url(r'^(?P<title>' + WIKI_URL_RE + r')/feeds/atom/$', AtomArticleHistoryFeed(),30 url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/feeds/atom/$', AtomArticleHistoryFeed(),
31 name='wiki_article_history_feed_atom'),31 name='wiki_article_history_feed_atom'),
3232
33 url(r'^(?P<title>' + WIKI_URL_RE + r')/$',33 url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/$',
34 views.view_article, name='wiki_article'),34 views.view_article, name='wiki_article'),
3535
36 url(r'^(?P<title>' + WIKI_URL_RE + r')/(?P<revision>\d+)/$',36 url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/(?P<revision>\d+)/$',
37 views.view_article, name='wiki_article_revision'),37 views.view_article, name='wiki_article_revision'),
3838
39 url(r'^edit/(?P<title>' + WIKI_URL_RE + r')/$',39 url(r'^edit/(?P<title>' + settings.WIKI_URL_RE + r')/$',
40 views.edit_article, name='wiki_edit'),40 views.edit_article, name='wiki_edit'),
4141
42 url(r'observe/(?P<title>' + WIKI_URL_RE + r')/$',42 url(r'observe/(?P<title>' + settings.WIKI_URL_RE + r')/$',
43 views.observe_article, name='wiki_observe'),43 views.observe_article, name='wiki_observe'),
4444
45 url(r'observe/(?P<title>' + WIKI_URL_RE + r')/stop/$', views.stop_observing_article,45 url(r'observe/(?P<title>' + settings.WIKI_URL_RE + r')/stop/$', views.stop_observing_article,
46 name='wiki_stop_observing'),46 name='wiki_stop_observing'),
4747
48 url(r'^history/(?P<title>' + WIKI_URL_RE + r')/$',48 url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/$',
49 views.article_history, name='wiki_article_history'),49 views.article_history, name='wiki_article_history'),
5050
51 url(r'^history/(?P<title>' + WIKI_URL_RE + r')/changeset/(?P<revision>\d+)/$', views.view_changeset,51 url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/changeset/(?P<revision>\d+)/$', views.view_changeset,
52 name='wiki_changeset',),52 name='wiki_changeset',),
5353
54 url(r'^history/(?P<title>' + WIKI_URL_RE + r')/changeset/(?P<revision_from>\d+)/(?P<revision>\d+)/$', views.view_changeset,54 url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/changeset/(?P<revision_from>\d+)/(?P<revision>\d+)/$', views.view_changeset,
55 name='wiki_changeset_compare',),55 name='wiki_changeset_compare',),
5656
57 url(r'^history/(?P<title>' + WIKI_URL_RE + r')/revert/$', views.revert_to_revision,57 url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/revert/$', views.revert_to_revision,
58 name='wiki_revert_to_revision'),58 name='wiki_revert_to_revision'),
5959
60 url(r'^backlinks/(?P<title>' + WIKI_URL_RE + r')/$', views.backlinks,60 url(r'^backlinks/(?P<title>' + settings.WIKI_URL_RE + r')/$', views.backlinks,
61 name='backlinks'),61 name='backlinks'),
62]62]
6363
=== modified file 'wiki/views.py'
--- wiki/views.py 2018-12-31 10:36:13 +0000
+++ wiki/views.py 2019-04-08 05:56:42 +0000
@@ -20,8 +20,8 @@
20from mainpage.templatetags.wl_markdown import do_wl_markdown20from mainpage.templatetags.wl_markdown import do_wl_markdown
21from markdownextensions.semanticwikilinks.mdx_semanticwikilinks import WIKILINK_RE21from markdownextensions.semanticwikilinks.mdx_semanticwikilinks import WIKILINK_RE
2222
23from wl_utils import get_real_ip23from mainpage.wl_utils import get_real_ip
24from wl_utils import get_valid_cache_key24from mainpage.wl_utils import get_valid_cache_key
2525
26import re26import re
27import urllib27import urllib
2828
=== modified file 'wlggz/migrations/0001_initial.py'
--- wlggz/migrations/0001_initial.py 2016-12-13 18:28:51 +0000
+++ wlggz/migrations/0001_initial.py 2019-04-08 05:56:42 +0000
@@ -3,7 +3,7 @@
33
4from django.db import models, migrations4from django.db import models, migrations
5from django.conf import settings5from django.conf import settings
6import wl_utils6import mainpage.wl_utils as wl_utils
77
88
9class Migration(migrations.Migration):9class Migration(migrations.Migration):
1010
=== modified file 'wlggz/models.py'
--- wlggz/models.py 2016-12-13 18:28:51 +0000
+++ wlggz/models.py 2019-04-08 05:56:42 +0000
@@ -9,12 +9,10 @@
99
10from django.db import models10from django.db import models
11from django.contrib.auth.models import User11from django.contrib.auth.models import User
12from wl_utils import AutoOneToOneField12from mainpage.wl_utils import AutoOneToOneField
13from django.utils.translation import ugettext_lazy as _13from django.utils.translation import ugettext_lazy as _
14from pybb.models import Post14from pybb.models import Post
1515
16import settings
17
1816
19class GGZAuth(models.Model):17class GGZAuth(models.Model):
20 user = AutoOneToOneField(18 user = AutoOneToOneField(
2119
=== modified file 'wlhelp/management/commands/update_help.py'
--- wlhelp/management/commands/update_help.py 2018-03-24 09:22:11 +0000
+++ wlhelp/management/commands/update_help.py 2019-04-08 05:56:42 +0000
@@ -26,7 +26,7 @@
26import subprocess26import subprocess
27import collections27import collections
2828
29from settings import MEDIA_ROOT, WIDELANDS_SVN_DIR, MEDIA_URL29from django.conf import settings
3030
31from widelandslib.tribe import *31from widelandslib.tribe import *
32from widelandslib.make_flow_diagram import make_all_subgraphs32from widelandslib.make_flow_diagram import make_all_subgraphs
@@ -45,8 +45,8 @@
45 self._delete_old_media_dir(45 self._delete_old_media_dir(
46 name) # You can deactivate this line if you don't need to clean house.46 name) # You can deactivate this line if you don't need to clean house.
4747
48 base_directory = os.path.normpath(WIDELANDS_SVN_DIR + '/data')48 base_directory = os.path.normpath(settings.WIDELANDS_SVN_DIR + '/data')
49 json_directory = os.path.normpath(MEDIA_ROOT + '/map_object_info')49 json_directory = os.path.normpath(settings.MEDIA_ROOT + '/map_object_info')
5050
51 tribeinfo_file = open(os.path.normpath(51 tribeinfo_file = open(os.path.normpath(
52 json_directory + '/tribe_' + name + '.json'), 'r')52 json_directory + '/tribe_' + name + '.json'), 'r')
@@ -59,7 +59,7 @@
59 self._to.descr = tribeinfo['tooltip']59 self._to.descr = tribeinfo['tooltip']
60 # copy icon60 # copy icon
61 dn = os.path.normpath('%s/wlhelp/img/%s/' %61 dn = os.path.normpath('%s/wlhelp/img/%s/' %
62 (MEDIA_ROOT, tribeinfo['name']))62 (settings.MEDIA_ROOT, tribeinfo['name']))
63 try:63 try:
64 os.makedirs(dn)64 os.makedirs(dn)
65 except OSError, o:65 except OSError, o:
@@ -69,7 +69,7 @@
69 file = os.path.normpath(base_directory + '/' + tribeinfo['icon'])69 file = os.path.normpath(base_directory + '/' + tribeinfo['icon'])
70 shutil.copy(file, new_name)70 shutil.copy(file, new_name)
71 self._to.icon_url = path.normpath(71 self._to.icon_url = path.normpath(
72 '%s/%s' % (MEDIA_URL, new_name[len(MEDIA_ROOT):]))72 '%s/%s' % (settings.MEDIA_URL, new_name[len(settings.MEDIA_ROOT):]))
73 self._to.save()73 self._to.save()
7474
75 def parse(self, tribename, base_directory, json_directory):75 def parse(self, tribename, base_directory, json_directory):
@@ -117,7 +117,7 @@
117117
118 print('Deleting old media files...')118 print('Deleting old media files...')
119 sdir = os.path.normpath(os.path.join(119 sdir = os.path.normpath(os.path.join(
120 MEDIA_ROOT, 'wlhelp/img', tribename))120 settings.MEDIA_ROOT, 'wlhelp/img', tribename))
121 if os.path.exists(sdir):121 if os.path.exists(sdir):
122 shutil.rmtree(sdir)122 shutil.rmtree(sdir)
123123
@@ -144,7 +144,7 @@
144144
145 """145 """
146 dn = os.path.normpath('%s/wlhelp/img/%s/%s/' %146 dn = os.path.normpath('%s/wlhelp/img/%s/%s/' %
147 (MEDIA_ROOT, self._to.name, name))147 (settings.MEDIA_ROOT, self._to.name, name))
148 try:148 try:
149 os.makedirs(dn)149 os.makedirs(dn)
150 except OSError, o:150 except OSError, o:
@@ -153,7 +153,7 @@
153 new_name = path.join(dn, fname)153 new_name = path.join(dn, fname)
154 shutil.copy(file, new_name)154 shutil.copy(file, new_name)
155155
156 return '%s%s' % (MEDIA_URL, new_name[len(MEDIA_ROOT):])156 return '%s%s' % (settings.MEDIA_URL, new_name[len(settings.MEDIA_ROOT):])
157157
158 def _parse_workers(self, base_directory, workersinfo):158 def _parse_workers(self, base_directory, workersinfo):
159 """Put the workers into the database."""159 """Put the workers into the database."""
@@ -283,9 +283,9 @@
283 help =\283 help =\
284 '''Regenerates and parses the json files in a current checkout. '''284 '''Regenerates and parses the json files in a current checkout. '''
285285
286 def handle(self, directory=os.path.normpath(WIDELANDS_SVN_DIR + '/data'), **kwargs):286 def handle(self, directory=os.path.normpath(settings.WIDELANDS_SVN_DIR + '/data'), **kwargs):
287287
288 json_directory = os.path.normpath(MEDIA_ROOT + '/map_object_info')288 json_directory = os.path.normpath(settings.MEDIA_ROOT + '/map_object_info')
289289
290 if not os.path.exists(json_directory):290 if not os.path.exists(json_directory):
291 os.makedirs(json_directory)291 os.makedirs(json_directory)
@@ -295,7 +295,7 @@
295 # First, we make sure that JSON files have been generated.295 # First, we make sure that JSON files have been generated.
296 current_dir = os.path.dirname(os.path.realpath(__file__))296 current_dir = os.path.dirname(os.path.realpath(__file__))
297 is_json_valid = False297 is_json_valid = False
298 os.chdir(WIDELANDS_SVN_DIR)298 os.chdir(settings.WIDELANDS_SVN_DIR)
299 try:299 try:
300 subprocess.check_call(300 subprocess.check_call(
301 [os.path.normpath('wl_map_object_info'), json_directory])301 [os.path.normpath('wl_map_object_info'), json_directory])
@@ -306,7 +306,7 @@
306306
307 # Now we validate that they are indeed JSON files (syntax check only)307 # Now we validate that they are indeed JSON files (syntax check only)
308 validator_script = os.path.normpath(308 validator_script = os.path.normpath(
309 WIDELANDS_SVN_DIR + '/utils/validate_json.py')309 settings.WIDELANDS_SVN_DIR + '/utils/validate_json.py')
310 if not os.path.isfile(validator_script):310 if not os.path.isfile(validator_script):
311 print("Wrong path for 'utils/validate_json.py': " +311 print("Wrong path for 'utils/validate_json.py': " +
312 validator_script + ' does not exist!')312 validator_script + ' does not exist!')
313313
=== modified file 'wlhelp/management/commands/update_help_pdf.py'
--- wlhelp/management/commands/update_help_pdf.py 2016-07-02 12:38:06 +0000
+++ wlhelp/management/commands/update_help_pdf.py 2019-04-08 05:56:42 +0000
@@ -1,7 +1,7 @@
1from ...models import Tribe as TribeModel1from ...models import Tribe as TribeModel
22
3from django.core.management.base import BaseCommand, CommandError3from django.core.management.base import BaseCommand, CommandError
4from settings import MEDIA_ROOT, WIDELANDS_SVN_DIR, MEDIA_URL4from django.conf import settings
55
6import os6import os
7import shutil7import shutil
@@ -17,7 +17,7 @@
17 help =\17 help =\
18 """Update the overview pdfs of all tribes in a current checkout"""18 """Update the overview pdfs of all tribes in a current checkout"""
1919
20 def handle(self, json_directory=os.path.normpath(MEDIA_ROOT + '/map_object_info'), **kwargs):20 def handle(self, json_directory=os.path.normpath(settings.MEDIA_ROOT + '/map_object_info'), **kwargs):
21 source_file = open(os.path.normpath(21 source_file = open(os.path.normpath(
22 json_directory + '/tribes.json'), 'r')22 json_directory + '/tribes.json'), 'r')
23 tribesinfo = json.load(source_file)23 tribesinfo = json.load(source_file)
@@ -31,7 +31,7 @@
31 pdffile = path.join(gdir, tribename + '.pdf')31 pdffile = path.join(gdir, tribename + '.pdf')
32 giffile = path.join(gdir, tribename + '.gif')32 giffile = path.join(gdir, tribename + '.gif')
3333
34 targetdir = path.normpath(path.join(MEDIA_ROOT, 'wlhelp',34 targetdir = path.normpath(path.join(settings.MEDIA_ROOT, 'wlhelp',
35 'network_graphs', tribename))35 'network_graphs', tribename))
3636
37 try:37 try:
@@ -45,9 +45,9 @@
45 tribe = Tribe.objects.get(name=tribename)45 tribe = Tribe.objects.get(name=tribename)
46 if tribe:46 if tribe:
47 tribe.network_pdf_url = path.normpath(47 tribe.network_pdf_url = path.normpath(
48 '%s/%s/%s' % (MEDIA_URL, targetdir[len(MEDIA_ROOT):], tribename + '.pdf'))48 '%s/%s/%s' % (settings.MEDIA_URL, targetdir[len(settings.MEDIA_ROOT):], tribename + '.pdf'))
49 tribe.network_gif_url = path.normpath(49 tribe.network_gif_url = path.normpath(
50 '%s/%s/%s' % (MEDIA_URL, targetdir[len(MEDIA_ROOT):], tribename + '.gif'))50 '%s/%s/%s' % (settings.MEDIA_URL, targetdir[len(settings.MEDIA_ROOT):], tribename + '.gif'))
51 tribe.save()51 tribe.save()
52 else:52 else:
53 print 'Could not set tribe urls'53 print 'Could not set tribe urls'
5454
=== modified file 'wlhelp/views.py'
--- wlhelp/views.py 2018-03-09 12:12:02 +0000
+++ wlhelp/views.py 2019-04-08 05:56:42 +0000
@@ -3,8 +3,6 @@
3from django.http import HttpResponse3from django.http import HttpResponse
4from .models import Worker, Ware, Building, Tribe4from .models import Worker, Ware, Building, Tribe
55
6from settings import WIDELANDS_SVN_DIR, MEDIA_ROOT
7
86
9def index(request):7def index(request):
10 tribes = Tribe.objects.all().order_by('displayname')8 tribes = Tribe.objects.all().order_by('displayname')
119
=== modified file 'wlimages/models.py'
--- wlimages/models.py 2018-10-03 20:25:05 +0000
+++ wlimages/models.py 2019-04-08 05:56:42 +0000
@@ -6,7 +6,7 @@
6from django.utils.translation import ugettext_lazy as _6from django.utils.translation import ugettext_lazy as _
7from django.db import IntegrityError7from django.db import IntegrityError
8from datetime import datetime8from datetime import datetime
9from settings import MEDIA_ROOT, MEDIA_URL9from django.conf import settings
10from django.core.files.storage import FileSystemStorage10from django.core.files.storage import FileSystemStorage
1111
1212
@@ -39,7 +39,7 @@
39 safe_filename = storage.get_valid_name(image.name)39 safe_filename = storage.get_valid_name(image.name)
40 im = self.create(content_type=content_type, object_id=object_id,40 im = self.create(content_type=content_type, object_id=object_id,
41 user=user, revision=1, name=image.name)41 user=user, revision=1, name=image.name)
42 path = '%swlimages/%s' % (MEDIA_ROOT, safe_filename)42 path = '%swlimages/%s' % (settings.MEDIA_ROOT, safe_filename)
4343
44 destination = open(path, 'wb')44 destination = open(path, 'wb')
45 for chunk in image.chunks():45 for chunk in image.chunks():
4646
=== modified file 'wlmaps/forms.py'
--- wlmaps/forms.py 2017-03-07 16:02:24 +0000
+++ wlmaps/forms.py 2019-04-08 05:56:42 +0000
@@ -7,11 +7,10 @@
7from django import forms7from django import forms
8from django.forms import ModelForm8from django.forms import ModelForm
9from django.core.files.storage import default_storage9from django.core.files.storage import default_storage
10from django.conf import settings
1011
11from settings import MEDIA_ROOT
12from wlmaps.models import Map12from wlmaps.models import Map
13import os13import os
14from settings import WIDELANDS_SVN_DIR
1514
16class UploadMapForm(ModelForm):15class UploadMapForm(ModelForm):
17 """16 """
@@ -46,7 +45,7 @@
46 try:45 try:
47 # Try to make a safe filename46 # Try to make a safe filename
48 safe_name = default_storage.get_valid_name(mem_file_obj.name)47 safe_name = default_storage.get_valid_name(mem_file_obj.name)
49 file_path = MEDIA_ROOT + 'wlmaps/maps/' + safe_name48 file_path = settings.MEDIA_ROOT + 'wlmaps/maps/' + safe_name
50 saved_file = default_storage.save(file_path, mem_file_obj)49 saved_file = default_storage.save(file_path, mem_file_obj)
51 except UnicodeEncodeError:50 except UnicodeEncodeError:
52 self._errors['file'] = self.error_class(51 self._errors['file'] = self.error_class(
@@ -57,7 +56,7 @@
57 try:56 try:
58 # call map info tool to generate minimap and json info file57 # call map info tool to generate minimap and json info file
59 old_cwd = os.getcwd()58 old_cwd = os.getcwd()
60 os.chdir(WIDELANDS_SVN_DIR)59 os.chdir(settings.WIDELANDS_SVN_DIR)
61 check_call(['wl_map_info', saved_file])60 check_call(['wl_map_info', saved_file])
6261
63 # TODO(shevonar): delete file because it will be saved again when62 # TODO(shevonar): delete file because it will be saved again when
@@ -90,7 +89,7 @@
9089
91 # mapinfo["minimap"] is an absolute path.90 # mapinfo["minimap"] is an absolute path.
92 # We partition it to get the correct file path91 # We partition it to get the correct file path
93 minimap_path = mapinfo['minimap'].partition(MEDIA_ROOT)[2]92 minimap_path = mapinfo['minimap'].partition(settings.MEDIA_ROOT)[2]
94 self.instance.minimap = '/' + minimap_path93 self.instance.minimap = '/' + minimap_path
9594
96 # the json file is no longer needed95 # the json file is no longer needed
9796
=== modified file 'wlmaps/tests/test_views.py'
--- wlmaps/tests/test_views.py 2018-11-18 17:22:39 +0000
+++ wlmaps/tests/test_views.py 2019-04-08 05:56:42 +0000
@@ -11,8 +11,6 @@
1111
12import os12import os
1313
14from settings import MEDIA_ROOT
15
16elven_forests = os.path.dirname(__file__) + '/data/Elven Forests.wmf'14elven_forests = os.path.dirname(__file__) + '/data/Elven Forests.wmf'
1715
18###########16###########
1917
=== modified file 'wlmaps/views.py'
--- wlmaps/views.py 2018-11-18 17:22:39 +0000
+++ wlmaps/views.py 2019-04-08 05:56:42 +0000
@@ -7,9 +7,10 @@
7from django.contrib.auth.decorators import login_required7from django.contrib.auth.decorators import login_required
8from django.http import HttpResponseRedirect, HttpResponseNotAllowed, HttpResponse, HttpResponseBadRequest8from django.http import HttpResponseRedirect, HttpResponseNotAllowed, HttpResponse, HttpResponseBadRequest
9from django.urls import reverse9from django.urls import reverse
10from django.conf import settings
10import models11import models
11from settings import MAPS_PER_PAGE12
12from wl_utils import get_real_ip13from mainpage.wl_utils import get_real_ip
13import os14import os
1415
1516
@@ -20,7 +21,7 @@
20 maps = models.Map.objects.all()21 maps = models.Map.objects.all()
21 return render(request, 'wlmaps/index.html',22 return render(request, 'wlmaps/index.html',
22 {'maps': maps,23 {'maps': maps,
23 'maps_per_page': MAPS_PER_PAGE,24 'maps_per_page': settings.MAPS_PER_PAGE,
24 })25 })
2526
2627
2728
=== modified file 'wlprofile/forms.py'
--- wlprofile/forms.py 2016-12-13 18:28:51 +0000
+++ wlprofile/forms.py 2019-04-08 05:56:42 +0000
@@ -9,7 +9,7 @@
9from django import forms9from django import forms
10from models import Profile10from models import Profile
1111
12import settings12from django.conf import settings
13import re13import re
1414
1515
1616
=== modified file 'wlprofile/migrations/0001_initial.py'
--- wlprofile/migrations/0001_initial.py 2016-12-13 18:28:51 +0000
+++ wlprofile/migrations/0001_initial.py 2019-04-08 05:56:42 +0000
@@ -3,7 +3,7 @@
33
4from django.db import models, migrations4from django.db import models, migrations
5from django.conf import settings5from django.conf import settings
6import wl_utils6import mainpage.wl_utils as wl_utils
7import wlprofile.fields7import wlprofile.fields
88
99
1010
=== modified file 'wlprofile/models.py'
--- wlprofile/models.py 2018-12-21 09:50:32 +0000
+++ wlprofile/models.py 2019-04-08 05:56:42 +0000
@@ -1,11 +1,11 @@
1from django.db import models1from django.db import models
2from django.contrib.auth.models import User2from django.contrib.auth.models import User
3from fields import ExtendedImageField3from fields import ExtendedImageField
4from wl_utils import AutoOneToOneField4from mainpage.wl_utils import AutoOneToOneField
5from django.utils.translation import ugettext_lazy as _5from django.utils.translation import ugettext_lazy as _
6from pybb.models import Post6from pybb.models import Post
77
8import settings8from django.conf import settings
99
10TZ_CHOICES = [(float(x[0]), x[1]) for x in (10TZ_CHOICES = [(float(x[0]), x[1]) for x in (
11 (-12, '-12'), (-11, '-11'), (-10, '-10'), (-9.5, '-09.5'), (-9, '-09'),11 (-12, '-12'), (-11, '-11'), (-10, '-10'), (-9.5, '-09.5'), (-9, '-09'),
1212
=== modified file 'wlprofile/templatetags/custom_date.py'
--- wlprofile/templatetags/custom_date.py 2018-04-08 14:40:17 +0000
+++ wlprofile/templatetags/custom_date.py 2019-04-08 05:56:42 +0000
@@ -18,7 +18,7 @@
18from django.contrib.auth.models import User18from django.contrib.auth.models import User
19import re19import re
20from datetime import date as ddate, tzinfo, timedelta, datetime20from datetime import date as ddate, tzinfo, timedelta, datetime
21from settings import DEFAULT_TIME_ZONE, DEFAULT_TIME_DISPLAY21from django.conf import settings
2222
23register = template.Library()23register = template.Library()
2424
@@ -132,12 +132,12 @@
132 """If this user is logged in, return his representation, otherwise, return132 """If this user is logged in, return his representation, otherwise, return
133 a sane default."""133 a sane default."""
134 if not user.is_authenticated:134 if not user.is_authenticated:
135 return do_custom_date(DEFAULT_TIME_DISPLAY, date, float(DEFAULT_TIME_ZONE))135 return do_custom_date(settings.DEFAULT_TIME_DISPLAY, date, float(settings.DEFAULT_TIME_ZONE))
136 try:136 try:
137 userprofile = User.objects.get(username=user).wlprofile137 userprofile = User.objects.get(username=user).wlprofile
138 return do_custom_date(userprofile.time_display, date, userprofile.time_zone)138 return do_custom_date(userprofile.time_display, date, userprofile.time_zone)
139 except ObjectDoesNotExist:139 except ObjectDoesNotExist:
140 return do_custom_date(DEFAULT_TIME_DISPLAY, date, float(DEFAULT_TIME_ZONE))140 return do_custom_date(settings.DEFAULT_TIME_DISPLAY, date, float(settings.DEFAULT_TIME_ZONE))
141141
142custom_date.is_safe = False142custom_date.is_safe = False
143143
144144
=== modified file 'wlscheduling/templates/wlscheduling/other-users.html'
--- wlscheduling/templates/wlscheduling/other-users.html 2018-02-16 15:38:34 +0000
+++ wlscheduling/templates/wlscheduling/other-users.html 2019-04-08 05:56:42 +0000
@@ -1,8 +1,9 @@
1{% load static %}
1<div id="other-user-template" class="other-user-div" hidden="hidden">2<div id="other-user-template" class="other-user-div" hidden="hidden">
2 <div class="title">3 <div class="title">
3 <p></p>4 <p></p>
4 <button>5 <button>
5 <img src="/wlmedia/forum/img/send_pm.png" alt="" class="middle"><span class="middle">Send PM</span>6 <img src="{% static 'forum/img/send_pm.png'%}" alt="" class="middle"><span class="middle">Send PM</span>
6 </button>7 </button>
7 </div>8 </div>
8 <div class="other-days-container"></div>9 <div class="other-days-container"></div>
@@ -21,4 +22,4 @@
21 {% include "wlscheduling/clock-svg.html" %}22 {% include "wlscheduling/clock-svg.html" %}
22 </div>23 </div>
23 </div>24 </div>
24</div>
25\ No newline at end of file25\ No newline at end of file
26</div>
2627
=== modified file 'wlscreens/models.py'
--- wlscreens/models.py 2018-04-08 16:23:55 +0000
+++ wlscreens/models.py 2019-04-08 05:56:42 +0000
@@ -7,7 +7,7 @@
7from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile7from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile
8from django.core.files.storage import FileSystemStorage8from django.core.files.storage import FileSystemStorage
9import os9import os
10from settings import THUMBNAIL_SIZE, MEDIA_ROOT10from django.conf import settings
11from django.urls import reverse11from django.urls import reverse
1212
1313
@@ -21,7 +21,7 @@
21 # If the filename already exists, remove it as if it was a true file21 # If the filename already exists, remove it as if it was a true file
22 # system22 # system
23 if self.exists(name):23 if self.exists(name):
24 os.remove(os.path.join(MEDIA_ROOT, name))24 os.remove(os.path.join(settings.MEDIA_ROOT, name))
25 return name25 return name
2626
2727
@@ -80,7 +80,7 @@
80 if image.mode not in ('L', 'RGB'):80 if image.mode not in ('L', 'RGB'):
81 image = image.convert('RGB')81 image = image.convert('RGB')
8282
83 image.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS)83 image.thumbnail(settings.THUMBNAIL_SIZE, Image.ANTIALIAS)
8484
85 # Save the thumbnail85 # Save the thumbnail
86 temp_handle = StringIO()86 temp_handle = StringIO()
8787
=== modified file 'wlscreens/tests/test_models.py'
--- wlscreens/tests/test_models.py 2016-12-13 18:28:51 +0000
+++ wlscreens/tests/test_models.py 2019-04-08 05:56:42 +0000
@@ -9,7 +9,7 @@
9# Last Modified: $Date$9# Last Modified: $Date$
10#10#
1111
12from settings import THUMBNAIL_SIZE12from django.conf import settings
13from django.test import TestCase as DjangoTest13from django.test import TestCase as DjangoTest
14from django.db import IntegrityError14from django.db import IntegrityError
15from django.core.files.uploadedfile import SimpleUploadedFile15from django.core.files.uploadedfile import SimpleUploadedFile
@@ -71,7 +71,7 @@
71 screenshot=self.img,71 screenshot=self.img,
72 comment='This rockz!')72 comment='This rockz!')
73 self.assertEqual(i.pk, 1)73 self.assertEqual(i.pk, 1)
74 self.assertEqual(i.thumbnail.width, THUMBNAIL_SIZE[0])74 self.assertEqual(i.thumbnail.width, settings.THUMBNAIL_SIZE[0])
7575
7676
77class TestScreenshot(_ScreenshotBase):77class TestScreenshot(_ScreenshotBase):

Subscribers

People subscribed via source and target branches