Merge pull request #1588 from ostcar/python_requirements

Updated python requirements.
This commit is contained in:
Oskar Hahn 2015-07-03 11:04:24 +02:00
commit e6bc1c5016
11 changed files with 67 additions and 50 deletions

View File

@ -14,8 +14,12 @@ def test(args=None):
Runs the tests.
"""
module = getattr(args, 'module', '')
if module == '':
module = 'tests'
else:
module = 'tests.{}'.format(module)
return call("DJANGO_SETTINGS_MODULE='tests.settings' coverage run "
"./manage.py test tests.%s" % module)
"./manage.py test {}".format(module))
@argument('--plain', action='store_true')
@ -84,10 +88,10 @@ def min_requirements(args=None):
Uses requirements_production.txt by default.
"""
from pip.req import parse_requirements
import pip
def get_lowest_versions(requirements_file):
for line in parse_requirements(requirements_file):
for line in pip.req.parse_requirements(requirements_file, session=pip.download.PipSession()):
yield '%s==%s' % (line.req.key, line.req.specs[0][1])
print('pip install %s' % ' '.join(get_lowest_versions(args.requirements)))
@ -95,7 +99,7 @@ def min_requirements(args=None):
@command('clear',
help='Deletes unneeded files and folders')
def clear(args=None):
def clean(args=None):
"""
Deletes all .pyc and .orig files and empty folders.
"""
@ -103,24 +107,6 @@ def clear(args=None):
call('find -name "*.orig" -delete')
call('find -type d -empty -delete')
@command('po',
help="Generates the po-file for javascript")
def po(args=None):
# TODO: in the value "" there has to be the entry:
# "plural_forms: nplurals=2; plural=(n != 1);"
call('find openslides/ -iname "*.js" -or -iname "*.html" | '
'xargs xgettext --from-code=UTF-8 --language=JavaScript '
'--output=openslides/locale/en/javascript.po')
@argument('-l', '--language')
@command('po2json',
help="Generates json for a translated po file")
def po2json(args=None):
lang = args.language
call('node_modules/.bin/po2json openslides/locale/%s/javascript.po openslides/static/i18n/%s.json' %
(lang, lang))
@command('isort',
help='Sorts all imports in all python files.')

View File

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='item',
name='type',
field=models.IntegerField(verbose_name='Type', choices=[(1, 'Agenda item'), (2, 'Organizational item')], default=1),
),
]

View File

@ -120,8 +120,7 @@ class Item(RESTModelMixin, models.Model):
Flag, if the item is finished.
"""
type = models.IntegerField(max_length=1, choices=ITEM_TYPE,
default=AGENDA_ITEM, verbose_name=ugettext_lazy("Type"))
type = models.IntegerField(choices=ITEM_TYPE, default=AGENDA_ITEM, verbose_name=ugettext_lazy("Type"))
"""
Type of the agenda item.

View File

@ -83,7 +83,6 @@ INSTALLED_APPS = (
'django.contrib.staticfiles',
'django.contrib.humanize',
'haystack', # full-text-search
'ckeditor',
'rest_framework',
'openslides.poll', # TODO: try to remove this line
'openslides.agenda',

View File

@ -179,7 +179,6 @@ class Motion(RESTModelMixin, models.Model):
use_version.version_number = version_number + 1
# Necessary line if the version was set before the motion got an id.
# This is probably a Django bug.
use_version.motion = use_version.motion
use_version.save()
@ -339,7 +338,11 @@ class Motion(RESTModelMixin, models.Model):
attributes, it is populated with the data from the last version
object if such object exists.
"""
new_version = MotionVersion(motion=self, **kwargs)
if self.pk is None:
# Do not reference the MotionVersion object to an unsaved motion
new_version = MotionVersion(**kwargs)
else:
new_version = MotionVersion(motion=self, **kwargs)
if self.versions.exists():
last_version = self.get_last_version()
else:

View File

@ -5,7 +5,7 @@ from openslides.utils.rest_api import router
urlpatterns = patterns(
'',
url(r'^(?P<url>.*[^/])$', RedirectView.as_view(url='/%(url)s/')),
url(r'^(?P<url>.*[^/])$', RedirectView.as_view(url='/%(url)s/', permanent=True)),
url(r'^rest/', include(router.urls)),
url(r'^agenda/', include('openslides.agenda.urls')),
url(r'^assignments/', include('openslides.assignments.urls')),

View File

@ -0,0 +1,28 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='user',
name='groups',
field=models.ManyToManyField(
verbose_name='groups',
related_query_name='user',
to='auth.Group',
related_name='user_set',
help_text='The groups this user belongs to. A user will get all '
'permissions granted to each of their groups.',
blank=True),
),
migrations.AlterField(
model_name='user',
name='last_login',
field=models.DateTimeField(verbose_name='last login', blank=True, null=True),
),
]

View File

@ -1,16 +1,14 @@
# Requirements for OpenSlides in production in alphabetical order
Django>=1.7,<1.8
Django>=1.7.1,<1.9
beautifulsoup4>=4.1,<4.4
bleach>=1.4,<1.5
django-ckeditor-updated>=4.2.3,<4.4
django-haystack>=2.1,<2.4
django-haystack>=2.1,<2.5
djangorestframework>=3.0.5,<3.2.0
jsonfield>=0.9.19,<1.1
natsort>=3.2,<3.6
reportlab>=3.0,<3.2
natsort>=3.2,<4.1
reportlab>=3.0,<3.3
roman>=2.0,<2.1
setuptools>=2.2,<18.0
setuptools>=2.2,<19.0
sockjs-tornado>=1.0,<1.1
tornado>=2.1,<4.1
whoosh>=2.5.6,<2.6
whoosh>=2.5.6,<2.8

View File

@ -268,7 +268,8 @@ class MarkElectedOtherUser(TestCase):
self.assertTrue(Assignment.objects.get(pk=self.assignment.pk).elected.filter(username='test_user_Oonei3rahji5jugh1eev').exists())
def test_mark_unelected(self):
self.assignment.set_elected(get_user_model().objects.get(username='test_user_Oonei3rahji5jugh1eev'))
user = get_user_model().objects.get(username='test_user_Oonei3rahji5jugh1eev')
self.assignment.set_elected(user)
response = self.client.delete(
reverse('assignment-mark-elected', args=[self.assignment.pk]),
{'user': self.user.pk})

View File

@ -1,5 +1,3 @@
from unittest import skip
from openslides.core.config import config
from openslides.motions.exceptions import WorkflowError
from openslides.motions.models import Motion, State, Workflow
@ -56,14 +54,6 @@ class ModelTest(TestCase):
self._title
self.assertEqual(motion.title, 'v3')
@skip
def test_absolute_url(self):
motion_id = self.motion.id
self.assertEqual(self.motion.get_absolute_url('detail'), '/motions/%d/' % motion_id)
self.assertEqual(self.motion.get_absolute_url('update'), '/motions/%d/edit/' % motion_id)
self.assertEqual(self.motion.get_absolute_url('delete'), '/motions/%d/del/' % motion_id)
def test_supporter(self):
self.assertFalse(self.motion.is_supporter(self.test_user))
self.motion.supporters.add(self.test_user)

View File

@ -87,9 +87,6 @@ class TestFunctions(TestCase):
inner_function()
browser_mock.open.assert_called_with('http://localhost:8234')
def test_get_database_path_from_settings_memory(self):
self.assertEqual(main.get_database_path_from_settings(), ':memory:')
def test_translate_customizable_strings(self):
self.assertEqual(config['general_event_description'], 'Presentation and assembly system')
main.translate_customizable_strings('de')