本文整理匯總了Python中fedocal.fedocallib.model.Meeting.copy方法的典型用法代碼示例。如果您正苦於以下問題:Python Meeting.copy方法的具體用法?Python Meeting.copy怎麽用?Python Meeting.copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fedocal.fedocallib.model.Meeting
的用法示例。
在下文中一共展示了Meeting.copy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: update_date_rec_meeting
# 需要導入模塊: from fedocal.fedocallib.model import Meeting [as 別名]
# 或者: from fedocal.fedocallib.model.Meeting import copy [as 別名]
def update_date_rec_meeting(meeting, action='last'):
""" From a recursive meeting, returns a meeting which date corresponds
either to that of the last recursion that occured, or the next recursion
that will occur.
"""
if meeting.recursion_frequency and meeting.recursion_ends \
and is_date_in_future(
meeting.recursion_ends, meeting.meeting_time_start):
meetingobj = Meeting.copy(meeting)
while meetingobj.meeting_date < date.today():
if meetingobj.recursion_ends < meetingobj.meeting_date + \
timedelta(
days=meetingobj.recursion_frequency
): # pragma: no cover
break
meetingobj.meeting_date = meetingobj.meeting_date + \
timedelta(days=meetingobj.recursion_frequency)
meetingobj.meeting_date_end = meetingobj.meeting_date_end + \
timedelta(days=meetingobj.recursion_frequency)
meetingobj.meeting_manager_user = meeting.meeting_manager_user
meeting = meetingobj
if action == 'last':
meeting.meeting_date = meeting.meeting_date - \
timedelta(days=meeting.recursion_frequency)
meeting.meeting_date_end = meeting.meeting_date_end - \
timedelta(days=meeting.recursion_frequency)
return meeting
示例2: update_date_rec_meeting
# 需要導入模塊: from fedocal.fedocallib.model import Meeting [as 別名]
# 或者: from fedocal.fedocallib.model.Meeting import copy [as 別名]
def update_date_rec_meeting(meeting, action='last', date_limit=None):
""" From a recursive meeting, returns a meeting which date corresponds
either to that of the last recursion that occured, or the next recursion
that will occur.
"""
if not date_limit:
date_limit = date.today()
if date_limit < meeting.meeting_date:
date_limit = meeting.meeting_date
if meeting.recursion_frequency and meeting.recursion_ends:
meetingobj = Meeting.copy(meeting)
while meetingobj.meeting_date < date_limit:
if meetingobj.recursion_ends < meetingobj.meeting_date + \
timedelta(
days=meetingobj.recursion_frequency
): # pragma: no cover
break
meetingobj.meeting_date = meetingobj.meeting_date + \
timedelta(days=meetingobj.recursion_frequency)
meetingobj.meeting_date_end = meetingobj.meeting_date_end + \
timedelta(days=meetingobj.recursion_frequency)
meetingobj.meeting_manager_user = meeting.meeting_manager_user
if action == 'last':
last_date = meetingobj.meeting_date - \
timedelta(days=meetingobj.recursion_frequency)
if meeting.meeting_date < last_date:
meetingobj.meeting_date = last_date
meetingobj.meeting_date_end = meetingobj.meeting_date_end - \
timedelta(days=meetingobj.recursion_frequency)
meeting = meetingobj
return meeting
示例3:
# 需要導入模塊: from fedocal.fedocallib.model import Meeting [as 別名]
# 或者: from fedocal.fedocallib.model.Meeting import copy [as 別名]
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
)
flask.flash("Meeting updated")
return flask.redirect(flask.url_for("view_meeting", meeting_id=meeting_id))
else:
if (
meeting.recursion_frequency
and meeting.recursion_ends
and fedocallib.is_date_in_future(meeting.recursion_ends, meeting.meeting_time_start)
):
cnt = 0
meetingobj = Meeting.copy(meeting)
while meetingobj.meeting_date < datetime.date.today():
if meetingobj.recursion_ends < meetingobj.meeting_date + datetime.timedelta(
days=meetingobj.recursion_frequency * cnt
):
break
meetingobj = Meeting.copy(meeting)
meetingobj.meeting_date = meetingobj.meeting_date + datetime.timedelta(
days=meetingobj.recursion_frequency * cnt
)
cnt = cnt + 1
meeting = meetingobj
if not fedocallib.is_date_in_future(meeting.meeting_date, meeting.meeting_time_start):
flask.flash("This meeting has already occured, you may not " "change it anymore", "warnings")
return flask.redirect(flask.url_for("my_meetings"))
form = forms.AddMeetingForm(meeting=meeting, tzone=get_timezone())