← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands-website/widelands_trunk_binaries into lp:widelands-website

 

kaputtnik has proposed merging lp:~widelands-dev/widelands-website/widelands_trunk_binaries into lp:widelands-website.

Commit message:
Change the PATH variable to include widelands/trunk.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/widelands_trunk_binaries/+merge/319233

In conjunction with 

https://code.launchpad.net/~widelands-dev/widelands/move_website_binaries/+merge/319231

this branch makes it possible to upload a map on the local website.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/widelands_trunk_binaries into lp:widelands-website.
=== modified file 'local_settings.py.sample'
--- local_settings.py.sample	2017-01-21 19:22:57 +0000
+++ local_settings.py.sample	2017-03-07 16:46:15 +0000
@@ -5,7 +5,12 @@
 
 STATIC_MEDIA_PATH = os.path.join(bd, 'media')
 MEDIA_ROOT = os.path.join(bd, 'media/')
+
+# If you are using the developer version of widelands from Luanchpad
+# set WIDELANDS_SVN_DIR to the correct path. See also:
+# https://wl.widelands.org/wiki/BzrPrimer/
 WIDELANDS_SVN_DIR = "/path/to/widelands/trunk/"
+os.environ['PATH'] = WIDELANDS_SVN_DIR + ':' + os.environ['PATH']
 
 DATABASES = {
    'default': {

=== modified file 'wlmaps/forms.py'
--- wlmaps/forms.py	2016-12-09 10:10:57 +0000
+++ wlmaps/forms.py	2017-03-07 16:46:15 +0000
@@ -10,7 +10,8 @@
 
 from settings import MEDIA_ROOT
 from wlmaps.models import Map
-
+import os
+from settings import WIDELANDS_SVN_DIR
 
 class UploadMapForm(ModelForm):
     """
@@ -55,11 +56,14 @@
 
         try:
             # call map info tool to generate minimap and json info file
+            old_cwd = os.getcwd()
+            os.chdir(WIDELANDS_SVN_DIR)
             check_call(['wl_map_info', saved_file])
 
             # TODO(shevonar): delete file because it will be saved again when
             # the model is saved. File should not be saved twice
             default_storage.delete(saved_file)
+            os.chdir(old_cwd)
         except CalledProcessError:
             self._errors['file'] = self.error_class(
                 ['The map file could not be processed.'])


Follow ups