本文整理汇总了Python中pycalendar.datetime.DateTime.offsetYear方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.offsetYear方法的具体用法?Python DateTime.offsetYear怎么用?Python DateTime.offsetYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycalendar.datetime.DateTime
的用法示例。
在下文中一共展示了DateTime.offsetYear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doCapabilities
# 需要导入模块: from pycalendar.datetime import DateTime [as 别名]
# 或者: from pycalendar.datetime.DateTime import offsetYear [as 别名]
def doCapabilities(self, request):
"""
Return a list of all timezones known to the server.
"""
# Determine min/max date-time for iSchedule
now = DateTime.getNowUTC()
minDateTime = DateTime(now.getYear(), 1, 1, 0, 0, 0, Timezone.UTCTimezone)
minDateTime.offsetYear(-1)
maxDateTime = DateTime(now.getYear(), 1, 1, 0, 0, 0, Timezone.UTCTimezone)
maxDateTime.offsetYear(10)
dataTypes = []
dataTypes.append(
ischedulexml.CalendarDataType(**{
"content-type": "text/calendar",
"version": "2.0",
})
)
if config.EnableJSONData:
dataTypes.append(
ischedulexml.CalendarDataType(**{
"content-type": "application/calendar+json",
"version": "2.0",
})
)
componentTypes = []
from twistedcaldav.ical import allowedSchedulingComponents
for name in allowedSchedulingComponents:
if name == "VFREEBUSY":
componentTypes.append(
ischedulexml.Component(
ischedulexml.Method(name="REQUEST"),
name=name
)
)
else:
componentTypes.append(
ischedulexml.Component(
ischedulexml.Method(name="REQUEST"),
ischedulexml.Method(name="CANCEL"),
ischedulexml.Method(name="REPLY"),
name=name
)
)
result = ischedulexml.QueryResult(
ischedulexml.Capabilities(
ischedulexml.Version.fromString(config.Scheduling.iSchedule.SerialNumber),
ischedulexml.Versions(
ischedulexml.Version.fromString("1.0"),
),
ischedulexml.SchedulingMessages(*componentTypes),
ischedulexml.CalendarDataTypes(*dataTypes),
ischedulexml.Attachments(
ischedulexml.External(),
),
ischedulexml.MaxContentLength.fromString(config.MaxResourceSize),
ischedulexml.MinDateTime.fromString(minDateTime.getText()),
ischedulexml.MaxDateTime.fromString(maxDateTime.getText()),
ischedulexml.MaxInstances.fromString(config.MaxAllowedInstances),
ischedulexml.MaxRecipients.fromString(config.MaxAttendeesPerInstance),
ischedulexml.Administrator.fromString(request.unparseURL(params="", querystring="", fragment="")),
),
)
response = XMLResponse(responsecode.OK, result)
response.headers.addRawHeader(ISCHEDULE_CAPABILITIES, str(config.Scheduling.iSchedule.SerialNumber))
return response