本文整理汇总了Python中fedocal.fedocallib.model.Meeting.by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Meeting.by_id方法的具体用法?Python Meeting.by_id怎么用?Python Meeting.by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fedocal.fedocallib.model.Meeting
的用法示例。
在下文中一共展示了Meeting.by_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_meeting
# 需要导入模块: from fedocal.fedocallib.model import Meeting [as 别名]
# 或者: from fedocal.fedocallib.model.Meeting import by_id [as 别名]
def delete_meeting(meeting_id):
""" Delete a specific meeting given its identifier.
:arg meeting_id: the identifier of the meeting to delete.
"""
if not flask.g.fas_user:
return flask.redirect(flask.url_for("index"))
meeting = Meeting.by_id(SESSION, meeting_id)
if not (is_meeting_manager(meeting) or is_calendar_admin(meeting.calendar) or is_admin()):
flask.flash(
"You are not one of the manager of this meeting, " "or an admin, you are not allowed to delete it.",
"errors",
)
return flask.redirect(flask.url_for("view_meeting", meeting_id=meeting_id))
calendars = Calendar.get_all(SESSION)
deleteform = forms.DeleteMeetingForm()
# pylint: disable=E1101
if deleteform.validate_on_submit():
if deleteform.confirm_delete.data:
if deleteform.confirm_futher_delete.data:
fedocallib.delete_recursive_meeting(SESSION, meeting)
else:
meeting.delete(SESSION)
try:
SESSION.commit()
except SQLAlchemyError, err:
SESSION.rollback()
print "edit_meeting:", err
flask.flash("Could not update this meeting.", "error")
flask.flash("Meeting deleted")
return flask.redirect(flask.url_for("calendar", calendar_name=meeting.calendar_name))
示例2: view_meeting_page
# 需要导入模块: from fedocal.fedocallib.model import Meeting [as 别名]
# 或者: from fedocal.fedocallib.model.Meeting import by_id [as 别名]
def view_meeting_page(meeting_id, full):
""" View a specific meeting given its identifier.
:arg meeting_id: the identifier of the meeting to visualize.
"""
meeting = Meeting.by_id(SESSION, meeting_id)
tzone = get_timezone()
if not meeting:
flask.flash("No meeting could be found for this identifier", "errors")
return flask.redirect(flask.url_for("index"))
meeting = fedocallib.convert_meeting_timezone(meeting, "UTC", tzone)
auth_form = forms.LoginForm()
editor = is_admin()
if not editor:
if is_meeting_manager(meeting) or is_calendar_admin(meeting.calendar):
editor = True
return flask.render_template(
"view_meeting.html",
full=full,
meeting=meeting,
tzone=tzone,
title=meeting.meeting_name,
editor=editor,
auth_form=auth_form,
)
示例3: edit_meeting
# 需要导入模块: from fedocal.fedocallib.model import Meeting [as 别名]
# 或者: from fedocal.fedocallib.model.Meeting import by_id [as 别名]
def edit_meeting(meeting_id):
""" Edit a specific meeting based on the meeting identifier.
:arg meeting_id: the identifier of the meeting to edit.
"""
if not flask.g.fas_user:
return flask.redirect(flask.url_for("index"))
meeting = Meeting.by_id(SESSION, meeting_id)
calendarobj = Calendar.by_id(SESSION, meeting.calendar_name)
if not (is_meeting_manager(meeting) or is_calendar_admin(meeting.calendarobj) or is_admin()):
flask.flash(
"You are not one of the manager of this meeting, " "or an admin, you are not allowed to edit it.", "errors"
)
return flask.redirect(flask.url_for("view_meeting", meeting_id=meeting_id))
tzone = get_timezone()
form = forms.AddMeetingForm()
# pylint: disable=E1101
if form.validate_on_submit():
try:
fedocallib.edit_meeting(
session=SESSION,
meeting=meeting,
calendarobj=calendarobj,
fas_user=flask.g.fas_user,
meeting_name=form.meeting_name.data,
meeting_date=form.meeting_date.data,
meeting_date_end=None,
meeting_time_start=form.meeting_time_start.data,
meeting_time_stop=form.meeting_time_stop.data,
comanager=form.comanager.data,
meeting_information=form.information.data,
meeting_region=form.meeting_region.data,
tzone=get_timezone(),
recursion_frequency=form.frequency.data,
recursion_ends=form.end_repeats.data,
remind_when=form.remind_when.data,
remind_who=form.remind_who.data,
full_day=form.full_day.data,
edit_all_meeting=form.recursive_edit.data,
admin=is_admin(),
)
except FedocalException, err:
flask.flash(err, "warnings")
return flask.render_template(
"edit_meeting.html", meeting=meeting, calendar=calendarobj, form=form, tzone=tzone
)
except SQLAlchemyError, err:
SESSION.rollback()
print "edit_meeting:", err
flask.flash("Could not update this meeting.", "errors")
return flask.render_template(
"edit_meeting.html", meeting=meeting, calendar=calendarobj, form=form, tzone=tzone
)
示例4: delete_meeting
# 需要导入模块: from fedocal.fedocallib.model import Meeting [as 别名]
# 或者: from fedocal.fedocallib.model.Meeting import by_id [as 别名]
def delete_meeting(meeting_id):
""" Delete a specific meeting given its identifier.
:arg meeting_id: the identifier of the meeting to delete.
"""
if not flask.g.fas_user:
return flask.redirect(flask.url_for('index'))
meeting = Meeting.by_id(SESSION, meeting_id)
if meeting.calendar.calendar_status != 'Enabled':
flask.flash('This calendar is "%s", you are not allowed to delete '
'its meetings anymore.' % calendarobj.calendar_status,
'errors')
return flask.redirect(flask.url_for('calendar',
calendar_name=calendar_name))
if not (is_meeting_manager(meeting)
or is_calendar_admin(meeting.calendar)
or is_admin()):
flask.flash('You are not one of the manager of this meeting, '
'or an admin, you are not allowed to delete it.',
'errors')
return flask.redirect(flask.url_for('view_meeting',
meeting_id=meeting_id))
calendars = Calendar.get_all(SESSION)
deleteform = forms.DeleteMeetingForm()
# pylint: disable=E1101
if deleteform.validate_on_submit():
if deleteform.confirm_delete.data:
if deleteform.confirm_futher_delete.data:
fedocallib.delete_recursive_meeting(SESSION, meeting)
else:
meeting.delete(SESSION)
try:
SESSION.commit()
except SQLAlchemyError, err:
SESSION.rollback()
print 'edit_meeting:', err
flask.flash('Could not update this meeting.', 'error')
flask.flash('Meeting deleted')
fedmsg.publish(topic="meeting.delete", msg=dict(
agent=flask.g.fas_user.username,
meeting=meeting.to_json(),
calendar=meeting.calendar.to_json(),
))
return flask.redirect(flask.url_for(
'calendar', calendar_name=meeting.calendar_name))
示例5: edit_meeting
# 需要导入模块: from fedocal.fedocallib.model import Meeting [as 别名]
# 或者: from fedocal.fedocallib.model.Meeting import by_id [as 别名]
def edit_meeting(meeting_id):
""" Edit a specific meeting based on the meeting identifier.
:arg meeting_id: the identifier of the meeting to edit.
"""
if not flask.g.fas_user:
return flask.redirect(flask.url_for('index'))
meeting = Meeting.by_id(SESSION, meeting_id)
calendarobj = Calendar.by_id(SESSION, meeting.calendar_name)
if calendarobj.calendar_status != 'Enabled':
flask.flash('This calendar is "%s", you are not allowed to edit its '
'meetings anymore.' % calendarobj.calendar_status,
'errors')
return flask.redirect(flask.url_for('calendar',
calendar_name=calendar_name))
if not (is_meeting_manager(meeting)
or is_calendar_admin(calendarobj)
or is_admin()):
flask.flash('You are not one of the manager of this meeting, '
'or an admin, you are not allowed to edit it.',
'errors')
return flask.redirect(flask.url_for('view_meeting',
meeting_id=meeting_id))
tzone = get_timezone()
form = forms.AddMeetingForm(timezone=tzone)
# pylint: disable=E1101
if form.validate_on_submit():
tzone = form.meeting_timezone.data or tzone
try:
fedocallib.edit_meeting(
session=SESSION,
meeting=meeting,
calendarobj=calendarobj,
fas_user=flask.g.fas_user,
meeting_name=form.meeting_name.data,
meeting_date=form.meeting_date.data,
meeting_date_end=None,
meeting_time_start=form.meeting_time_start.data,
meeting_time_stop=form.meeting_time_stop.data,
comanager=form.comanager.data,
meeting_information=form.information.data,
meeting_region=form.meeting_region.data,
tzone=tzone,
recursion_frequency=form.frequency.data,
recursion_ends=form.end_repeats.data,
remind_when=form.remind_when.data,
remind_who=form.remind_who.data,
full_day=form.full_day.data,
edit_all_meeting=form.recursive_edit.data,
admin=is_admin())
except FedocalException, err:
flask.flash(err, 'warnings')
return flask.render_template(
'edit_meeting.html', meeting=meeting, calendar=calendarobj,
form=form, tzone=tzone)
except SQLAlchemyError, err:
SESSION.rollback()
print 'edit_meeting:', err
flask.flash('Could not update this meeting.', 'errors')
return flask.render_template(
'edit_meeting.html', meeting=meeting,
calendar=calendarobj, form=form, tzone=tzone)