Merge branch 'stable/1.2.x'
Conflicts: openslides/application/views.py
This commit is contained in:
commit
5353053d29
@ -5,10 +5,11 @@
|
||||
: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):
|
||||
"""Derives a PEP386-compliant version number from VERSION."""
|
||||
# TODO: Get the Version Hash from GIT.
|
||||
if version is None:
|
||||
version = VERSION
|
||||
assert len(version) == 5
|
||||
@ -24,59 +25,9 @@ def get_version(version=None):
|
||||
|
||||
sub = ''
|
||||
if version[3] == 'alpha' and version[4] == 0:
|
||||
mercurial_version = hg_version()
|
||||
if mercurial_version != 'unknown':
|
||||
sub = '.dev%s' % mercurial_version
|
||||
else:
|
||||
sub = '.dev'
|
||||
|
||||
elif version[3] != 'final':
|
||||
sub = "-" + version[3] + str(version[4])
|
||||
|
||||
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 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):
|
||||
"""
|
||||
|
@ -15,9 +15,9 @@ from django.test.client import Client
|
||||
from django.contrib.auth.models import User
|
||||
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):
|
||||
def setUp(self):
|
||||
@ -60,6 +60,10 @@ class ItemTest(TestCase):
|
||||
self.assertEqual(initial['parent'], 0)
|
||||
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):
|
||||
def setUp(self):
|
||||
|
@ -20,7 +20,7 @@ class ApplicationTest(TestCase):
|
||||
def setUp(self):
|
||||
self.admin = User.objects.create_user('testadmin', '', 'default')
|
||||
self.anonym = User.objects.create_user('testanoym', '', 'default')
|
||||
self.app1 = Application(submitter=self.admin)
|
||||
self.app1 = Application(submitter=self.admin.openslidesuser)
|
||||
self.app1.save()
|
||||
|
||||
def refresh(self):
|
||||
|
@ -67,7 +67,7 @@ class GeneralConfig(FormView):
|
||||
anonymous = Group.objects.get(name='Anonymous')
|
||||
except Group.DoesNotExist:
|
||||
default_perms = [u'can_see_agenda', u'can_see_projector',
|
||||
u'can_see_application']
|
||||
u'can_see_application', 'can_see_assignment']
|
||||
anonymous = Group()
|
||||
anonymous.name = 'Anonymous'
|
||||
anonymous.save()
|
||||
|
Loading…
Reference in New Issue
Block a user