当前位置: 首页>>代码示例>>Python>>正文


Python Meeting.copy方法代码示例

本文整理汇总了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
开发者ID:docent-net,项目名称:fedocal,代码行数:31,代码来源:__init__.py

示例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
开发者ID:trasher,项目名称:fedocal,代码行数:37,代码来源:__init__.py

示例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())
开发者ID:robyduck,项目名称:fedocal,代码行数:33,代码来源:__init__.py


注:本文中的fedocal.fedocallib.model.Meeting.copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。