cleanup openslides base files.
Do not manipulate the pythonpath anymore.
This commit is contained in:
parent
5fcef8aba4
commit
aa130ab2da
@ -55,7 +55,6 @@ def hg_version():
|
||||
try:
|
||||
ui = hgui.ui()
|
||||
repository = localrepository(ui, join(conts, '..'))
|
||||
#repository = localrepository(ui, conts)
|
||||
ctx = repository['.']
|
||||
if ctx.tags() and ctx.tags() != ['tip']:
|
||||
version = ' '.join(ctx.tags())
|
||||
@ -77,7 +76,7 @@ def hg_version():
|
||||
return version
|
||||
|
||||
|
||||
import os, site
|
||||
|
||||
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
|
||||
site.addsitedir(SITE_ROOT)
|
||||
## import os, site
|
||||
##
|
||||
## SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
|
||||
## site.addsitedir(SITE_ROOT)
|
||||
|
@ -104,23 +104,12 @@ class Item(MPTTModel, SlideMixin):
|
||||
self.closed = closed
|
||||
self.save()
|
||||
|
||||
## @property
|
||||
## def active_parent(self):
|
||||
## """
|
||||
## Return True if the item has an active parent.
|
||||
## """
|
||||
## sid = get_active_slide(only_sid=True).split()
|
||||
## if len(sid) == 2 and sid[0] == self.prefix:
|
||||
## if self.get_ancestors().filter(pk=sid[0]).exists():
|
||||
## return True
|
||||
## return False
|
||||
|
||||
@property
|
||||
def weight_form(self):
|
||||
"""
|
||||
Return the WeightForm for this item.
|
||||
"""
|
||||
from agenda.forms import ItemOrderForm
|
||||
from openslides.agenda.forms import ItemOrderForm
|
||||
try:
|
||||
parent = self.parent.id
|
||||
except AttributeError:
|
||||
|
@ -11,8 +11,8 @@
|
||||
"""
|
||||
|
||||
from django.conf.urls.defaults import url, patterns
|
||||
from agenda.views import (Overview, View, SetClosed, ItemUpdate, ItemCreate,
|
||||
ItemDelete, AgendaPDF)
|
||||
from openslides.agenda.views import (Overview, View, SetClosed, ItemUpdate,
|
||||
ItemCreate, ItemDelete, AgendaPDF)
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$',
|
||||
|
@ -12,10 +12,10 @@
|
||||
|
||||
from django.conf.urls.defaults import url, patterns
|
||||
|
||||
from application.views import (ApplicationDelete, ViewPoll, ApplicationPDF,
|
||||
ApplicationPollPDF, CreateAgendaItem)
|
||||
from openslides.application.views import (ApplicationDelete, ViewPoll,
|
||||
ApplicationPDF, ApplicationPollPDF, CreateAgendaItem)
|
||||
|
||||
urlpatterns = patterns('application.views',
|
||||
urlpatterns = patterns('openslides.application.views',
|
||||
url(r'^$',
|
||||
'overview',
|
||||
name='application_overview',
|
||||
|
@ -13,10 +13,10 @@
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _, ugettext_noop
|
||||
|
||||
from utils.forms import CssClassMixin
|
||||
from openslides.utils.forms import CssClassMixin
|
||||
|
||||
from participant.models import Profile
|
||||
from assignment.models import Assignment
|
||||
from openslides.participant.models import Profile
|
||||
from openslides.assignment.models import Assignment
|
||||
|
||||
|
||||
class AssignmentForm(forms.ModelForm, CssClassMixin):
|
||||
|
@ -26,7 +26,7 @@ from openslides.participant.models import Profile
|
||||
from openslides.poll.models import (BasePoll, CountInvalid, CountVotesCast,
|
||||
BaseOption, PublishPollMixin)
|
||||
|
||||
from agenda.models import Item
|
||||
from openslides.agenda.models import Item
|
||||
|
||||
|
||||
class Assignment(models.Model, SlideMixin):
|
||||
|
@ -12,10 +12,10 @@
|
||||
|
||||
from django.conf.urls.defaults import url, patterns
|
||||
|
||||
from assignment.views import (ViewPoll, AssignmentPDF, AssignmentPollPDF,
|
||||
AssignmentPollDelete, CreateAgendaItem)
|
||||
from openslides.assignment.views import (ViewPoll, AssignmentPDF,
|
||||
AssignmentPollPDF, AssignmentPollDelete, CreateAgendaItem)
|
||||
|
||||
urlpatterns = patterns('assignment.views',
|
||||
urlpatterns = patterns('openslides.assignment.views',
|
||||
url(r'^$',
|
||||
'get_overview',
|
||||
name='assignment_overview',
|
||||
|
@ -25,11 +25,11 @@ from django.contrib.auth.models import User
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.translation import ungettext, ugettext as _
|
||||
|
||||
from utils.pdf import stylesheet
|
||||
from utils.template import Tab
|
||||
from utils.utils import (template, permission_required, gen_confirm_form,
|
||||
del_confirm_form, ajax_request)
|
||||
from utils.views import FormView, DeleteView, PDFView, RedirectView
|
||||
from openslides.utils.pdf import stylesheet
|
||||
from openslides.utils.template import Tab
|
||||
from openslides.utils.utils import (template, permission_required,
|
||||
gen_confirm_form, del_confirm_form, ajax_request)
|
||||
from openslides.utils.views import FormView, DeleteView, PDFView, RedirectView
|
||||
|
||||
from openslides.config.models import config
|
||||
from openslides.participant.models import Profile
|
||||
|
@ -116,7 +116,8 @@ def set_submenu(sender, request, context, **kwargs):
|
||||
except (ImportError, AttributeError):
|
||||
continue
|
||||
|
||||
appname = mod.__name__.split('.')[0]
|
||||
appname = mod.__name__.split('.')[-1]
|
||||
|
||||
selected = reverse('config_%s' % appname) == request.path
|
||||
try:
|
||||
title = mod.NAME
|
||||
|
@ -33,7 +33,7 @@ for app in settings.INSTALLED_APPS:
|
||||
mod = import_module(app + '.views')
|
||||
except ImportError:
|
||||
continue
|
||||
appname = mod.__name__.split('.')[0]
|
||||
appname = mod.__name__.split('.')[-2]
|
||||
try:
|
||||
urlpatterns += patterns('', url(
|
||||
r'^%s/$' % appname,
|
||||
|
@ -10,6 +10,7 @@
|
||||
:license: GNU GPL, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
# for python 2.5 support
|
||||
from __future__ import with_statement
|
||||
|
||||
import os
|
||||
@ -72,6 +73,7 @@ def main(argv = None):
|
||||
start_browser(url)
|
||||
execute_from_command_line(argv)
|
||||
|
||||
|
||||
def detect_listen_opts(address, port):
|
||||
if address is None:
|
||||
try:
|
||||
@ -93,6 +95,7 @@ def detect_listen_opts(address, port):
|
||||
|
||||
return address, port
|
||||
|
||||
|
||||
def start_browser(url):
|
||||
browser = webbrowser.get()
|
||||
def f():
|
||||
@ -102,6 +105,7 @@ def start_browser(url):
|
||||
t = threading.Thread(target = f)
|
||||
t.start()
|
||||
|
||||
|
||||
def prepare_openslides(url, always_syncdb = False):
|
||||
settings_module = os.environ.get(django.conf.ENVIRONMENT_VARIABLE)
|
||||
if not settings_module:
|
||||
@ -140,6 +144,7 @@ def prepare_openslides(url, always_syncdb = False):
|
||||
create_or_reset_admin_user()
|
||||
return True
|
||||
|
||||
|
||||
def run_syncdb(url):
|
||||
# now initialize the database
|
||||
argv = ["", "syncdb", "--noinput"]
|
||||
@ -147,6 +152,7 @@ def run_syncdb(url):
|
||||
|
||||
set_system_url(url)
|
||||
|
||||
|
||||
def check_database(url):
|
||||
"""Detect if database was deleted and recreate if necessary"""
|
||||
# can't be imported in global scope as they already require
|
||||
@ -162,6 +168,7 @@ def check_database(url):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def create_or_reset_admin_user():
|
||||
# can't be imported in global scope as it already requires
|
||||
# the settings module during import
|
||||
@ -180,6 +187,7 @@ def create_or_reset_admin_user():
|
||||
obj.set_password("admin")
|
||||
obj.save()
|
||||
|
||||
|
||||
def set_system_url(url):
|
||||
# can't be imported in global scope as it already requires
|
||||
# the settings module during import
|
||||
@ -196,5 +204,6 @@ def generate_secret_key():
|
||||
chars = "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)"
|
||||
return get_random_string(50, chars)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from django.conf.global_settings import *
|
||||
|
||||
_fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
|
||||
def _fs2unicode(s):
|
||||
@ -21,11 +20,10 @@ def _fs2unicode(s):
|
||||
return s.decode(_fs_encoding)
|
||||
|
||||
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
|
||||
#SITE_ROOT = os.path.join(SITE_ROOT, '..')
|
||||
|
||||
|
||||
AUTH_PROFILE_MODULE = 'participant.Profile'
|
||||
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', 'openslides.utils.auth.AnonymousAuth',)
|
||||
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',
|
||||
'openslides.utils.auth.AnonymousAuth',)
|
||||
|
||||
LOGIN_URL = '/login/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
@ -34,16 +32,15 @@ DBPATH = _fs2unicode(os.path.join(os.path.join(SITE_ROOT, '..'), 'database.db'))
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': DBPATH, # Or path to database file if using sqlite3.
|
||||
'USER': '', # Not used with sqlite3.
|
||||
'PASSWORD': '', # Not used with sqlite3.
|
||||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
||||
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': DBPATH,
|
||||
'USER': '',
|
||||
'PASSWORD': '',
|
||||
'HOST': '',
|
||||
'PORT': '',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ugettext = lambda s: s
|
||||
|
||||
LANGUAGES = (
|
||||
@ -111,7 +108,8 @@ MIDDLEWARE_CLASSES = (
|
||||
ROOT_URLCONF = 'openslides.urls'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||
# Put strings here, like "/home/html/django_templates" or
|
||||
# "C:/www/django/templates".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
_fs2unicode(os.path.join(SITE_ROOT, 'templates')),
|
||||
@ -124,14 +122,14 @@ INSTALLED_APPS = (
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'mptt',
|
||||
'utils',
|
||||
'poll',
|
||||
'projector',
|
||||
'agenda',
|
||||
'application',
|
||||
'assignment',
|
||||
'participant',
|
||||
'config',
|
||||
'openslides.utils',
|
||||
'openslides.poll',
|
||||
'openslides.projector',
|
||||
'openslides.agenda',
|
||||
'openslides.application',
|
||||
'openslides.assignment',
|
||||
'openslides.participant',
|
||||
'openslides.config',
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
@ -140,6 +138,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.core.context_processors.request',
|
||||
'django.core.context_processors.i18n',
|
||||
'django.core.context_processors.static',
|
||||
'utils.utils.revision',
|
||||
'openslides.utils.utils.revision',
|
||||
'openslides.utils.auth.anonymous_context_additions',
|
||||
)
|
||||
|
@ -13,9 +13,10 @@
|
||||
from django.conf.urls.defaults import url, patterns
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from participant.views import ParticipantsListPDF, ParticipantsPasswordsPDF
|
||||
from openslides.participant.views import (ParticipantsListPDF,
|
||||
ParticipantsPasswordsPDF)
|
||||
|
||||
urlpatterns = patterns('participant.views',
|
||||
urlpatterns = patterns('openslides.participant.views',
|
||||
url(r'^$',
|
||||
'get_overview',
|
||||
name='user_overview',
|
||||
|
@ -160,7 +160,7 @@ class BasePoll(models.Model):
|
||||
"""
|
||||
Return the form for one option of the poll.
|
||||
"""
|
||||
from poll.forms import OptionForm
|
||||
from openslides.poll.forms import OptionForm
|
||||
return OptionForm(extra=self.get_form_values(kwargs['formid']),
|
||||
**kwargs)
|
||||
|
||||
|
@ -17,7 +17,7 @@ from openslides.projector.views import (ControlView, ActivateView,
|
||||
CountdownEdit, ProjectorEdit, Projector, ActivateOverlay)
|
||||
|
||||
|
||||
urlpatterns = patterns('projector.views',
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$',
|
||||
Projector.as_view(),
|
||||
{'sid': None},
|
||||
|
@ -10,26 +10,25 @@
|
||||
:license: GNU GPL, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
from django.conf.urls.defaults import patterns, url, include
|
||||
from django.conf import settings
|
||||
from django.utils.importlib import import_module
|
||||
from django.conf.urls.defaults import patterns, url, include
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.importlib import import_module
|
||||
|
||||
from openslides.utils.views import FrontPage
|
||||
|
||||
handler500 = 'openslides.utils.views.server_error'
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
# frontpage
|
||||
(r'^$', FrontPage.as_view()),
|
||||
|
||||
(r'^agenda/', include('agenda.urls')),
|
||||
(r'^application/', include('application.urls')),
|
||||
(r'^assignment/', include('assignment.urls')),
|
||||
(r'^participant/', include('participant.urls')),
|
||||
(r'^config/', include('config.urls')),
|
||||
(r'^projector/', include('projector.urls')),
|
||||
(r'^agenda/', include('openslides.agenda.urls')),
|
||||
(r'^application/', include('openslides.application.urls')),
|
||||
(r'^assignment/', include('openslides.assignment.urls')),
|
||||
(r'^participant/', include('openslides.participant.urls')),
|
||||
(r'^config/', include('openslides.config.urls')),
|
||||
(r'^projector/', include('openslides.projector.urls')),
|
||||
(r'^i18n/', include('django.conf.urls.i18n')),
|
||||
)
|
||||
|
||||
@ -44,7 +43,8 @@ for plugin in settings.INSTALLED_PLUGINS:
|
||||
continue
|
||||
|
||||
plugin_name = mod.__name__.split('.')[0]
|
||||
urlpatterns += patterns('', (r'^%s/' % plugin_name, include('%s.urls' % plugin_name)))
|
||||
urlpatterns += patterns('', (r'^%s/' % plugin_name, include('%s.urls'
|
||||
% plugin_name)))
|
||||
js_info_dict['packages'].append(plugin_name)
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ urlpatterns += patterns('',
|
||||
),
|
||||
|
||||
url(r'^usersettings/$',
|
||||
'participant.views.user_settings',
|
||||
'openslides.participant.views.user_settings',
|
||||
name='user_settings',
|
||||
),
|
||||
|
||||
|
@ -90,7 +90,7 @@ stylesheet.add(ParagraphStyle(
|
||||
leading=20,
|
||||
), alias='h3')
|
||||
stylesheet.add(ParagraphStyle(
|
||||
name 'Heading4',
|
||||
name='Heading4',
|
||||
parent=stylesheet['Bold'],
|
||||
fontSize=10,
|
||||
leading=20,
|
||||
|
Loading…
Reference in New Issue
Block a user