Skip to content

Commit

Permalink
Remaining linter issues (are we done?)
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Apr 25, 2019
1 parent 4513877 commit 15181a0
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 55 deletions.
2 changes: 1 addition & 1 deletion funnel/extapi/boxoffice.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def get_tickets(self, ic):
'ticket_type': line_item.get('item', {}).get('title', '')[:80],
'order_no': unicode(order.get('invoice_no')),
'status': status
})
})

return tickets
6 changes: 4 additions & 2 deletions funnel/forms/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ class ProjectForm(forms.Form):
description=__("Eg. Bangalore, Mumbai, Pune"))
date = forms.DateField(__("Start date"),
validators=[forms.validators.DataRequired(__("Start date is required"))])
date_upto = forms.DateField(__("End date"),
date_upto = forms.DateField(
__("End date"),
validators=[
forms.validators.DataRequired(__("End date is required")),
forms.validators.GreaterThanEqualTo('date', __("End date cannot be before start date"))
])
]
)
tagline = forms.StringField(__("Tagline"), validators=[forms.validators.DataRequired(), forms.validators.Length(max=250)],
description=__("This is displayed on the card on the homepage"))
website = forms.URLField(__("Website"),
Expand Down
13 changes: 6 additions & 7 deletions funnel/forms/proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class ProposalForm(forms.Form):
('Workshop', __("Workshop")),
('Discussion', __("Discussion")),
('Panel', __("Panel")),
])
])
technical_level = forms.RadioField(__("Technical level"), validators=[forms.validators.DataRequired()], choices=[
('Beginner', __("Beginner")),
('Intermediate', __("Intermediate")),
('Advanced', __("Advanced")),
])
])
description = forms.MarkdownField(__("Description"), validators=[forms.validators.DataRequired()],
description=__("A detailed description of the session"))
requirements = forms.MarkdownField(__("Requirements"),
Expand Down Expand Up @@ -89,12 +89,11 @@ def set_queries(self):


class ProposalMoveForm(forms.Form):
target = QuerySelectField(__("Move proposal to"), validators=[
forms.validators.DataRequired()], get_label='title')
target = QuerySelectField(__("Move proposal to"),
validators=[forms.validators.DataRequired()], get_label='title')

def set_queries(self):
team_ids = [t.id for t in g.user.teams]
self.target.query = Project.query.join(Project.profile).filter(
(Project.admin_team_id.in_(team_ids)) |
(Profile.admin_team_id.in_(team_ids))
).order_by(Project.date.desc())
(Project.admin_team_id.in_(team_ids)) | (Profile.admin_team_id.in_(team_ids))
).order_by(Project.date.desc())
2 changes: 1 addition & 1 deletion funnel/jobs/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def tag_locations(project_id):
tokens.append({'token': item.get('token', ''), 'geoname': {
'name': geoname['name'],
'geonameid': geoname['geonameid'],
}})
}})
else:
tokens.append({'token': item.get('token', '')})

Expand Down
2 changes: 1 addition & 1 deletion funnel/models/commentvote.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,5 @@ def permissions(self, user, inherited=None):
perms.update([
'edit_comment',
'delete_comment'
])
])
return perms
4 changes: 2 additions & 2 deletions funnel/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def make_private_key():
db.Column('event_id', None, db.ForeignKey('event.id'), primary_key=True),
db.Column('ticket_type_id', None, db.ForeignKey('ticket_type.id'), primary_key=True),
db.Column('created_at', db.DateTime, default=datetime.utcnow, nullable=False)
)
)


class ScopedNameTitleMixin(BaseScopedNameMixin):
Expand Down Expand Up @@ -209,7 +209,7 @@ def import_from_list(self, ticket_list):
company=ticket_dict['company'],
job_title=ticket_dict['job_title'],
city=ticket_dict['city']
)
)

ticket = SyncTicket.get(self, ticket_dict.get('order_no'), ticket_dict.get('ticket_no'))
if ticket and (ticket.participant is not participant or ticket_dict.get('status') == u'cancelled'):
Expand Down
2 changes: 1 addition & 1 deletion funnel/models/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __repr__(self):
*(make_timestamp_columns() + (
db.Column('proposal_id', None, db.ForeignKey('proposal.id'), nullable=False, primary_key=True),
db.Column('label_id', None, db.ForeignKey('label.id'), nullable=False, primary_key=True)
)))
)))


class Label(BaseScopedNameMixin, db.Model):
Expand Down
4 changes: 2 additions & 2 deletions funnel/models/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def permissions(self, user, inherited=None):
perms = super(Profile, self).permissions(user, inherited)
perms.add('view')
if user:
if (self.userid in user.user_organizations_owned_ids() or
(self.admin_team and user in self.admin_team.users)):
if (self.userid in user.user_organizations_owned_ids()
or (self.admin_team and user in self.admin_team.users)):
perms.add('edit-profile')
perms.add('new_project')
perms.add('delete-project')
Expand Down
14 changes: 7 additions & 7 deletions funnel/models/proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,17 @@ class Proposal(UuidMixin, BaseScopedIdNameMixin, CoordinatesMixin, db.Model):
'title', 'speaker', 'speaking', 'bio', 'section', 'objective', 'session_type',
'technical_level', 'description', 'requirements', 'slides', 'preview_video', 'links', 'location',
'latitude', 'longitude', 'coordinates'
},
},
'call': {
'url_for'
}
},
}
},
'reviewer': {
'read': {
'email', 'phone'
}
}
}
}

def __init__(self, **kwargs):
super(Proposal, self).__init__(**kwargs)
Expand Down Expand Up @@ -328,15 +328,15 @@ def permissions(self, user, inherited=None):
'vote_proposal',
'new_comment',
'vote_comment',
])
])
if user == self.owner:
perms.update([
'view-proposal',
'edit-proposal',
'delete-proposal', # FIXME: Prevent deletion of confirmed proposals
'submit-proposal', # For workflows, to confirm the form is ready for submission (from draft state)
'transfer-proposal',
])
])
if self.speaker != self.user:
perms.add('decline-proposal') # Decline speaking
return perms
Expand Down Expand Up @@ -396,6 +396,6 @@ def redirect_view_args(self):
'profile': self.proposal.project.profile.name,
'project': self.proposal.project.name,
'proposal': self.proposal.url_name
}
}
else:
return {}
6 changes: 3 additions & 3 deletions funnel/models/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class Section(BaseScopedNameMixin, db.Model):
'all': {
'read': {
'id', 'name', 'title', 'description', 'public'
},
},
}
},
}

def __init__(self, **kwargs):
super(Section, self).__init__(**kwargs)
Expand All @@ -46,5 +46,5 @@ def permissions(self, user, inherited=None):
perms.update([
'edit-section',
'delete-section',
])
])
return perms
2 changes: 1 addition & 1 deletion funnel/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Session(UuidMixin, BaseScopedIdNameMixin, db.Model):
db.CheckConstraint(
'("start" IS NULL AND "end" IS NULL) OR ("start" IS NOT NULL AND "end" IS NOT NULL)',
'session_start_end_check')
)
)

@hybrid_property
def scheduled(self):
Expand Down
6 changes: 3 additions & 3 deletions funnel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def extract_twitter_handle(handle):

parsed_handle = urlparse(handle)
if (
(parsed_handle.netloc and parsed_handle.netloc != 'twitter.com') or
(not parsed_handle.netloc and len(handle) > 16) or
(not parsed_handle.path)
(parsed_handle.netloc and parsed_handle.netloc != 'twitter.com')
or (not parsed_handle.netloc and len(handle) > 16)
or (not parsed_handle.path)
):
return None

Expand Down
4 changes: 2 additions & 2 deletions funnel/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def project_data(project):
'bg_image': project.bg_image.url if project.bg_image is not None else "",
'bg_color': project.bg_color,
'explore_url': project.explore_url.url if project.explore_url is not None else "",
}
}


@route('/<profile>')
Expand Down Expand Up @@ -113,7 +113,7 @@ def json(self):
'rooms': [room_data(room) for room in self.obj.rooms],
'proposals': [proposal_data(proposal) for proposal in proposals],
'schedule': schedule_data(self.obj),
})
})

@route('csv')
@requires_permission('view')
Expand Down
2 changes: 1 addition & 1 deletion funnel/views/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def section_data(section):
'description': section.description,
'url': None,
'json_url': None
}
}


@route('/<profile>/<project>/sections')
Expand Down
4 changes: 2 additions & 2 deletions funnel/views/venue.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def venue_data(venue):
'longitude': venue.longitude,
'url': None,
'json_url': None,
}
}


def room_data(room):
Expand All @@ -43,7 +43,7 @@ def room_data(room):
'bgcolor': room.bgcolor,
'url': None,
'json_url': None,
}
}


@route('/<profile>/<project>/venues')
Expand Down
4 changes: 2 additions & 2 deletions migrations/versions/140c9b68d65b_team_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def upgrade():
sa.Column('orgid', sa.String(length=22), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('userid')
)
)
op.create_table('users_teams',
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=False),
Expand All @@ -34,7 +34,7 @@ def upgrade():
sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('user_id', 'team_id')
)
)
op.drop_column('user', 'description')


Expand Down
2 changes: 1 addition & 1 deletion migrations/versions/4b630fb42760_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def upgrade():
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.ForeignKeyConstraint(['votespace_id'], ['votespace.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('user_id','votespace_id')
sa.UniqueConstraint('user_id', 'votespace_id')
)
op.create_table('comment',
sa.Column('id', sa.Integer(), nullable=False),
Expand Down
2 changes: 1 addition & 1 deletion migrations/versions/5290f9238875_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def upgrade():
sa.Column('presentation', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['proposal_id'], ['proposal.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('proposal_id','auth_type','id_type','userid')
sa.UniqueConstraint('proposal_id', 'auth_type', 'id_type', 'userid')
)


Expand Down
2 changes: 1 addition & 1 deletion migrations/versions/c3069d33419a_comment_uuid_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
comment = table('comment',
column('id', sa.Integer()),
column('uuid', UUIDType(binary=False)),
)
)


def get_progressbar(label, maxval):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
('proposal_space_redirect', 'project_redirect'),
('proposal_space_section', 'section'),
('votespace', 'voteset'),
]
]

# (old, new)
renamed_sequences = [
('commentspace_id_seq', 'commentset_id_seq'),
('proposal_space_id_seq', 'project_id_seq'),
('proposal_space_section_id_seq', 'section_id_seq'),
('votespace_id_seq', 'voteset_id_seq'),
]
]

# (table, old, new)
renamed_columns = [
Expand Down Expand Up @@ -60,7 +60,7 @@
('user_group', 'proposal_space_id', 'project_id'),
('venue', 'proposal_space_id', 'project_id'),
('vote', 'votespace_id', 'voteset_id'),
]
]

# (table, old, new)
renamed_constraints = [
Expand Down Expand Up @@ -117,7 +117,7 @@
('vote', 'vote_user_id_votespace_id_key', 'vote_user_id_voteset_id_key'),
('vote', 'vote_votespace_id_fkey', 'vote_voteset_id_fkey'),
('voteset', 'votespace_pkey', 'voteset_pkey'),
]
]


def upgrade():
Expand Down
2 changes: 1 addition & 1 deletion migrations/versions/eec2fad0f3e9_venue_uuid_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
venue = table('venue',
column('id', sa.Integer()),
column('uuid', UUIDType(binary=False)),
)
)


def get_progressbar(label, maxval):
Expand Down
Loading

0 comments on commit 15181a0

Please sign in to comment.