From d2d3725eb6808cd3d65af825d46993816db300b9 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sun, 15 Apr 2012 16:00:25 +0200 Subject: [PATCH 1/3] fix agenda.test --- openslides/agenda/tests.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/openslides/agenda/tests.py b/openslides/agenda/tests.py index 5de26ea45..2415c8fec 100644 --- a/openslides/agenda/tests.py +++ b/openslides/agenda/tests.py @@ -18,7 +18,6 @@ from django.db.models.query import EmptyQuerySet from projector.api import get_active_slide from agenda.models import Item -from agenda.api import is_summary class ItemTest(TestCase): def setUp(self): @@ -90,28 +89,16 @@ class ViewTest(TestCase): def testActivate(self): c = self.adminClient - response = c.get('/agenda/%d/activate/' % self.item1.id) + response = c.get('/projector/activate/%s/' % self.item1.sid) self.assertEqual(response.status_code, 302) self.assertTrue(self.item1.active) self.assertFalse(self.item2.active) - self.assertFalse(is_summary()) - response = c.get('/agenda/%d/activate/summary/' % self.item2.id) - self.assertEqual(response.status_code, 302) - self.assertTrue(self.item2.active) - self.assertFalse(self.item1.active) - self.assertTrue(is_summary()) - - response = c.get('/agenda/%d/activate/' % 0) + response = c.get('/projector/activate/%s/' % 'agenda') self.assertEqual(response.status_code, 302) self.assertFalse(self.item2.active) self.assertFalse(self.item1.active) - self.assertEqual(get_active_slide(only_sid=True), 'agenda_show') - - response = c.get('/agenda/%d/activate/' % 10000) - self.assertEqual(response.status_code, 404) - self.assertFalse(self.item2.active) - self.assertFalse(self.item1.active) + self.assertEqual(get_active_slide(only_sid=True), 'agenda') def testClose(self): c = self.adminClient From 92305bf36374d5042c05c247a540d5d734518f89 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sun, 15 Apr 2012 16:02:13 +0200 Subject: [PATCH 2/3] use item for item sid --- openslides/agenda/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 1bf0fe4fc..c55087a73 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -117,7 +117,7 @@ class Item(MPTTModel, SlideMixin): order_insertion_by = ['weight', 'title'] -register_slidemodel(Item, model_name=_('Agenda Item')) +register_slidemodel(Item) # TODO: put this in another file From beaa3e341acdf0d001b2f5dfd07d6cc242451262 Mon Sep 17 00:00:00 2001 From: Andy Kittner Date: Sun, 15 Apr 2012 16:04:08 +0200 Subject: [PATCH 3/3] Create portable win32 binary distribution --- extras/win32-portable/create_portable.txt | 12 + extras/win32-portable/openslides.c | 125 +++++++++ extras/win32-portable/openslides.exe | Bin 0 -> 7168 bytes extras/win32-portable/prepare_portable.py | 292 ++++++++++++++++++++++ openslides/main.py | 152 +++++++++++ start.py | 6 + 6 files changed, 587 insertions(+) create mode 100644 extras/win32-portable/create_portable.txt create mode 100644 extras/win32-portable/openslides.c create mode 100644 extras/win32-portable/openslides.exe create mode 100644 extras/win32-portable/prepare_portable.py create mode 100644 openslides/main.py create mode 100755 start.py diff --git a/extras/win32-portable/create_portable.txt b/extras/win32-portable/create_portable.txt new file mode 100644 index 000000000..2054e0d10 --- /dev/null +++ b/extras/win32-portable/create_portable.txt @@ -0,0 +1,12 @@ +How to create a new portable windows distribution of openslides: +---------------------------------------------------------------- +1.) Follow the openslides installation instructions for windows, but add + the option "-Z" when executing easy_install e.g.: + easy_install -Z django django-mptt reportlab pil + +2.) in the main directory of the openslides checkout execute: + python extras/win32-portable/prepare_portable.py + + +3.) The portable openslides distribution is now ready as a zip in the dist/ + directory diff --git a/extras/win32-portable/openslides.c b/extras/win32-portable/openslides.c new file mode 100644 index 000000000..7086a7da7 --- /dev/null +++ b/extras/win32-portable/openslides.c @@ -0,0 +1,125 @@ +#include +#include +#include + +#define _WIN32_LEAN_AND_MEAN +#include + +#include + +static const char *site_code = + "import sys;" + "import os;" + "import site;" + "path = os.path.dirname(sys.executable);" + "site_dir = os.path.join(path, \"site-packages\");" + "site.addsitedir(site_dir);" + "sys.path.append(path)"; + +static const char *run_openslides_code = + "import openslides.main;" + "openslides.main.main()"; + +/* determine the path to the executable + * NOTE: Py_GetFullProgramPath() can't be used because + * this would trigger pythons search-path initialization + * But we need this to initialize PYTHONHOME before this happens + */ +static char * +_get_module_name() +{ + size_t size = 1; + char *name = NULL; + int i; + + /* a path > 40k would be insane, it is more likely something + * else has gone very wrong on the system + */ + for (i = 0;i < 10; i++) + { + DWORD res; + char *n; + + n = realloc(name, size); + if (!n) + { + free(name); + return NULL; + } + name = n; + + res = GetModuleFileNameA(NULL, name, size); + if (res != 0 && res < size) + { + return name; + } + else if (res == size) + { + /* NOTE: Don't check GetLastError() == ERROR_INSUFFICIENT_BUFFER + * here, it isn't set consisntently across all platforms + */ + + size += 4096; + } + else + { + DWORD err = GetLastError(); + fprintf(stderr, "WARNING: GetModuleFileName() failed " + "(res = %d, err = %d)", res, err); + free(name); + return NULL; + + } + } + + return NULL; +} + +static int +_run() +{ + if (PyRun_SimpleString(site_code) != 0) + { + fprintf(stderr, "ERROR: failed to initialize site path\n"); + return 1; + } + + if (PyRun_SimpleString(run_openslides_code) != 0) + { + fprintf(stderr, "ERROR: failed to execute openslides\n"); + return 1; + } + + return 0; +} + + +int +main(int argc, char *argv[]) +{ + int returncode; + char *py_home, *sep = NULL; + + Py_SetProgramName(argv[0]); + + py_home = _get_module_name(); + + if (py_home) + sep = strrchr(py_home, '\\'); + /* should always be the true */ + if (sep) + { + *sep = '\0'; + Py_SetPythonHome(py_home); + } + + Py_Initialize(); + PySys_SetArgvEx(argc, argv, 0); + + returncode = _run(); + + Py_Finalize(); + free(py_home); + + return returncode; +} diff --git a/extras/win32-portable/openslides.exe b/extras/win32-portable/openslides.exe new file mode 100644 index 0000000000000000000000000000000000000000..55a24e895183383f158097748d77212bdbc8976e GIT binary patch literal 7168 zcmeHMe{j=h8Gny8-z6Zrb);zzdyQm zhsw3-+QFKUl<`pa0s* z5yRHkR(6EKvXGP#y^=2`_>TfM_c(Ur?1d{po&yrgiWku-r4L7TU zH$s8z9@WY(Krg~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