Fixed pep8 errors

This commit is contained in:
Oskar Hahn 2013-02-02 10:52:13 +01:00
parent 4cc6539f0c
commit 3ffb16d4d8
6 changed files with 31 additions and 30 deletions

View File

@ -8,4 +8,4 @@ install:
- python extras/scripts/create_local_settings.py - python extras/scripts/create_local_settings.py
script: script:
- coverage run ./manage.py test tests && coverage report -m - coverage run ./manage.py test tests && coverage report -m
- pep8 --max-line-length=150 --exclude="urls.py,motion/" --statistics openslides - pep8 --max-line-length=150 --exclude="urls.py," --statistics openslides

View File

@ -1,3 +1,2 @@
import openslides.motion.signals import openslides.motion.signals
import openslides.motion.slides import openslides.motion.slides

View File

@ -340,16 +340,16 @@ class Motion(SlideMixin, models.Model):
* reset_state * reset_state
""" """
actions = { actions = {
'edit': (self.is_submitter(person) and 'edit': ((self.is_submitter(person) and
self.state.edit_as_submitter) or self.state.edit_as_submitter) or
person.has_perm('motion.can_manage_motion'), person.has_perm('motion.can_manage_motion')),
'create_poll': person.has_perm('motion.can_manage_motion') and 'create_poll': (person.has_perm('motion.can_manage_motion') and
self.state.create_poll, self.state.create_poll),
'support': self.state.support and 'support': (self.state.support and
config['motion_min_supporters'] > 0 and config['motion_min_supporters'] > 0 and
not self.is_submitter(person), not self.is_submitter(person)),
'change_state': person.has_perm('motion.can_manage_motion'), 'change_state': person.has_perm('motion.can_manage_motion'),

View File

@ -338,6 +338,7 @@ def register_tab(request):
selected=selected, selected=selected,
) )
def get_widgets(request): def get_widgets(request):
return [Widget( return [Widget(
name='motions', name='motions',

View File

@ -7,6 +7,7 @@ ugettext = lambda s: s
_workflow = None _workflow = None
class State(object): class State(object):
def __init__(self, id, name, next_states=[], create_poll=False, support=False, def __init__(self, id, name, next_states=[], create_poll=False, support=False,
edit_as_submitter=False): edit_as_submitter=False):
@ -20,6 +21,7 @@ class State(object):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
class WorkflowError(Exception): class WorkflowError(Exception):
pass pass
@ -73,10 +75,8 @@ def populate_workflow(state, workflow):
DUMMY_STATE = State('dummy', ugettext('Unknwon state')) DUMMY_STATE = State('dummy', ugettext('Unknwon state'))
default_workflow = State('pub', ugettext('Published'), support=True, default_workflow = State('pub', ugettext('Published'), support=True, edit_as_submitter=True, next_states=[
edit_as_submitter=True, next_states=[ State('per', ugettext('Permitted'), create_poll=True, edit_as_submitter=True, next_states=[
State('per', ugettext('Permitted'), create_poll=True,
edit_as_submitter=True, next_states=[
State('acc', ugettext('Accepted')), State('acc', ugettext('Accepted')),
State('rej', ugettext('Rejected')), State('rej', ugettext('Rejected')),
State('wit', ugettext('Withdrawed')), State('wit', ugettext('Withdrawed')),

View File

@ -212,6 +212,7 @@ class TemplateView(PermissionMixin, ExtraContextMixin, _TemplateView):
class ListView(PermissionMixin, SetCookieMixin, ExtraContextMixin, _ListView): class ListView(PermissionMixin, SetCookieMixin, ExtraContextMixin, _ListView):
pass pass
class AjaxView(PermissionMixin, AjaxMixin, View): class AjaxView(PermissionMixin, AjaxMixin, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
return self.ajax_get(request, *args, **kwargs) return self.ajax_get(request, *args, **kwargs)