commit
6ec3bbfe3b
@ -5,10 +5,11 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
VERSION = (1, 2, 0, 'final', 1)
|
VERSION = (1, 2, 1, 'alpha', 0)
|
||||||
|
|
||||||
def get_version(version=None):
|
def get_version(version=None):
|
||||||
"""Derives a PEP386-compliant version number from VERSION."""
|
"""Derives a PEP386-compliant version number from VERSION."""
|
||||||
|
# TODO: Get the Version Hash from GIT.
|
||||||
if version is None:
|
if version is None:
|
||||||
version = VERSION
|
version = VERSION
|
||||||
assert len(version) == 5
|
assert len(version) == 5
|
||||||
@ -24,59 +25,9 @@ def get_version(version=None):
|
|||||||
|
|
||||||
sub = ''
|
sub = ''
|
||||||
if version[3] == 'alpha' and version[4] == 0:
|
if version[3] == 'alpha' and version[4] == 0:
|
||||||
mercurial_version = hg_version()
|
sub = '.dev'
|
||||||
if mercurial_version != 'unknown':
|
|
||||||
sub = '.dev%s' % mercurial_version
|
|
||||||
else:
|
|
||||||
sub = '.dev'
|
|
||||||
|
|
||||||
elif version[3] != 'final':
|
elif version[3] != 'final':
|
||||||
sub = "-" + version[3] + str(version[4])
|
sub = "-" + version[3] + str(version[4])
|
||||||
|
|
||||||
return main + sub
|
return main + sub
|
||||||
|
|
||||||
|
|
||||||
def hg_version():
|
|
||||||
import socket
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from os.path import realpath, join, dirname
|
|
||||||
try:
|
|
||||||
from mercurial import ui as hgui
|
|
||||||
from mercurial.localrepo import localrepository
|
|
||||||
from mercurial.node import short as shorthex
|
|
||||||
from mercurial.error import RepoError
|
|
||||||
nomercurial = False
|
|
||||||
except ImportError:
|
|
||||||
return 'unknown'
|
|
||||||
|
|
||||||
os.environ['HGRCPATH'] = ''
|
|
||||||
conts = realpath(join(dirname(__file__)))
|
|
||||||
try:
|
|
||||||
ui = hgui.ui()
|
|
||||||
repository = localrepository(ui, join(conts, '..'))
|
|
||||||
ctx = repository['.']
|
|
||||||
if ctx.tags() and ctx.tags() != ['tip']:
|
|
||||||
version = ' '.join(ctx.tags())
|
|
||||||
else:
|
|
||||||
version = '%(num)s:%(id)s' % {
|
|
||||||
'num': ctx.rev(), 'id': shorthex(ctx.node())
|
|
||||||
}
|
|
||||||
except TypeError:
|
|
||||||
version = 'unknown'
|
|
||||||
except RepoError:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
# This value defines the timeout for sockets in seconds. Per default python
|
|
||||||
# sockets do never timeout and as such we have blocking workers.
|
|
||||||
# Socket timeouts are set globally within the whole application.
|
|
||||||
# The value *must* be a floating point value.
|
|
||||||
socket.setdefaulttimeout(10.0)
|
|
||||||
|
|
||||||
return version
|
|
||||||
|
|
||||||
|
|
||||||
## import os, site
|
|
||||||
##
|
|
||||||
## SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
|
|
||||||
## site.addsitedir(SITE_ROOT)
|
|
||||||
|
@ -52,7 +52,14 @@ class Item(MPTTModel, SlideMixin):
|
|||||||
"""
|
"""
|
||||||
return the object, of which the item points.
|
return the object, of which the item points.
|
||||||
"""
|
"""
|
||||||
return get_slide_from_sid(self.related_sid, True)
|
object = get_slide_from_sid(self.related_sid, element=True)
|
||||||
|
if object is None:
|
||||||
|
self.title = 'Item for deleted slide: %s' % self.related_sid
|
||||||
|
self.related_sid = None
|
||||||
|
self.save()
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
return object
|
||||||
|
|
||||||
def get_related_type(self):
|
def get_related_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -15,9 +15,9 @@ from django.test.client import Client
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db.models.query import EmptyQuerySet
|
from django.db.models.query import EmptyQuerySet
|
||||||
|
|
||||||
from projector.api import get_active_slide
|
from openslides.projector.api import get_active_slide
|
||||||
|
|
||||||
from agenda.models import Item
|
from openslides.agenda.models import Item
|
||||||
|
|
||||||
class ItemTest(TestCase):
|
class ItemTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -60,6 +60,10 @@ class ItemTest(TestCase):
|
|||||||
self.assertEqual(initial['parent'], 0)
|
self.assertEqual(initial['parent'], 0)
|
||||||
self.assertEqual(initial['weight'], item.weight)
|
self.assertEqual(initial['weight'], item.weight)
|
||||||
|
|
||||||
|
def testRelated_sid(self):
|
||||||
|
self.item1.related_sid = 'foobar'
|
||||||
|
self.assertFalse(self.item1.get_related_slide() is None)
|
||||||
|
|
||||||
|
|
||||||
class ViewTest(TestCase):
|
class ViewTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -212,9 +212,6 @@ def edit(request, application_id=None):
|
|||||||
del_supporters = True
|
del_supporters = True
|
||||||
original_supporters = []
|
original_supporters = []
|
||||||
if is_manager:
|
if is_manager:
|
||||||
if application: # Edit application
|
|
||||||
for s in application.supporter.all():
|
|
||||||
original_supporters.append(s)
|
|
||||||
application = managerform.save(commit=False)
|
application = managerform.save(commit=False)
|
||||||
elif application_id is None:
|
elif application_id is None:
|
||||||
application = Application(submitter=request.user)
|
application = Application(submitter=request.user)
|
||||||
@ -229,28 +226,20 @@ def edit(request, application_id=None):
|
|||||||
trivial_change = False
|
trivial_change = False
|
||||||
application.save(request.user, trivial_change=trivial_change)
|
application.save(request.user, trivial_change=trivial_change)
|
||||||
if is_manager:
|
if is_manager:
|
||||||
# log added supporters
|
try:
|
||||||
supporters_added = []
|
new_supporters = set(managerform.cleaned_data['supporter'])
|
||||||
for s in application.supporter.all():
|
except KeyError:
|
||||||
if s not in original_supporters:
|
# The managerform has no field for the supporters
|
||||||
try:
|
pass
|
||||||
supporters_added.append(unicode(s.profile))
|
else:
|
||||||
except Profile.DoesNotExist:
|
old_supporters = set(application.supporter.all())
|
||||||
pass
|
# add new supporters
|
||||||
if len(supporters_added) > 0:
|
for supporter in new_supporters.difference(old_supporters):
|
||||||
log_added = ", ".join(supporters_added)
|
application.support(supporter)
|
||||||
application.writelog(_("Supporter: +%s") % log_added, request.user)
|
# remove old supporters
|
||||||
# log removed supporters
|
for supporter in old_supporters.difference(new_supporters):
|
||||||
supporters_removed = []
|
application.unsupport(supporter)
|
||||||
for s in original_supporters:
|
|
||||||
if s not in application.supporter.all():
|
|
||||||
try:
|
|
||||||
supporters_removed.append(unicode(s.profile))
|
|
||||||
except Profile.DoesNotExist:
|
|
||||||
pass
|
|
||||||
if len(supporters_removed) > 0:
|
|
||||||
log_removed = ", ".join(supporters_removed)
|
|
||||||
application.writelog(_("Supporter: -%s") % log_removed, request.user)
|
|
||||||
if application_id is None:
|
if application_id is None:
|
||||||
messages.success(request, _('New application was successfully created.'))
|
messages.success(request, _('New application was successfully created.'))
|
||||||
else:
|
else:
|
||||||
@ -280,10 +269,9 @@ def edit(request, application_id=None):
|
|||||||
if application_id is None:
|
if application_id is None:
|
||||||
initial = {'submitter': str(request.user.id)}
|
initial = {'submitter': str(request.user.id)}
|
||||||
else:
|
else:
|
||||||
initial = {}
|
initial = {'supporter': application.supporter.all()}
|
||||||
managerform = managerformclass(initial=initial, \
|
managerform = managerformclass(
|
||||||
instance=application, \
|
initial=initial, instance=application, prefix="manager")
|
||||||
prefix="manager")
|
|
||||||
else:
|
else:
|
||||||
managerform = None
|
managerform = None
|
||||||
return {
|
return {
|
||||||
|
@ -67,16 +67,16 @@ class GeneralConfig(FormView):
|
|||||||
anonymous = Group.objects.get(name='Anonymous')
|
anonymous = Group.objects.get(name='Anonymous')
|
||||||
except Group.DoesNotExist:
|
except Group.DoesNotExist:
|
||||||
default_perms = [u'can_see_agenda', u'can_see_projector',
|
default_perms = [u'can_see_agenda', u'can_see_projector',
|
||||||
u'can_see_application']
|
u'can_see_application', 'can_see_assignment']
|
||||||
anonymous = Group()
|
anonymous = Group()
|
||||||
anonymous.name = 'Anonymous'
|
anonymous.name = 'Anonymous'
|
||||||
anonymous.save()
|
anonymous.save()
|
||||||
anonymous.permissions = Permission.objects.filter(
|
anonymous.permissions = Permission.objects.filter(
|
||||||
codename__in=default_perms)
|
codename__in=default_perms)
|
||||||
anonymous.save()
|
anonymous.save()
|
||||||
messages.success(self.request,
|
messages.success(self.request,
|
||||||
_('Anonymous access enabled. Please modify the "Anonymous" ' \
|
_('Anonymous access enabled. Please modify the "Anonymous" ' \
|
||||||
'group to fit your required permissions.'))
|
'group to fit your required permissions.'))
|
||||||
else:
|
else:
|
||||||
config['system_enable_anonymous'] = False
|
config['system_enable_anonymous'] = False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user