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


Python TimezoneCache.create方法代码示例

本文整理汇总了Python中twistedcaldav.timezones.TimezoneCache.create方法的典型用法代码示例。如果您正苦于以下问题:Python TimezoneCache.create方法的具体用法?Python TimezoneCache.create怎么用?Python TimezoneCache.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twistedcaldav.timezones.TimezoneCache的用法示例。


在下文中一共展示了TimezoneCache.create方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_calendar_query_bogus_timezone_id

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_calendar_query_bogus_timezone_id(self):
        """
        Partial retrieval of events by time range.
        (CalDAV-access-09, section 7.6.1)
        """
        TimezoneCache.create()
        self.addCleanup(TimezoneCache.clear)

        calendar_properties = (
            davxml.GETETag(),
            caldavxml.CalendarData(),
        )

        query_timerange = caldavxml.TimeRange(
            start="%04d1001T000000Z" % (DateTime.getToday().getYear(),),
            end="%04d1101T000000Z" % (DateTime.getToday().getYear(),),
        )

        query = caldavxml.CalendarQuery(
            davxml.PropertyContainer(*calendar_properties),
            caldavxml.Filter(
                caldavxml.ComponentFilter(
                    caldavxml.ComponentFilter(
                        query_timerange,
                        name="VEVENT",
                    ),
                    name="VCALENDAR",
                ),
            ),
            caldavxml.TimeZoneID.fromString("bogus"),
        )

        result = yield self.calendar_query(query, got_xml=None, expected_code=responsecode.FORBIDDEN)
        self.assertTrue("valid-timezone" in result)
开发者ID:eventable,项目名称:CalendarServer,代码行数:36,代码来源:test_calendarquery.py

示例2: __init__

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
 def __init__(self, store, options, output, reactor, config):
     super(PodMigrationService, self).__init__(store)
     self.options = options
     self.output = output
     self.reactor = reactor
     self.config = config
     TimezoneCache.create()
开发者ID:eventable,项目名称:CalendarServer,代码行数:9,代码来源:pod_migration.py

示例3: __init__

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def __init__(self, store, options, reactor, config):
        super(ImporterService, self).__init__(store)
        self.options = options
        self.reactor = reactor
        self.config = config
        self._directory = self.store.directoryService()

        TimezoneCache.create()
开发者ID:eventable,项目名称:CalendarServer,代码行数:10,代码来源:importer.py

示例4: _calendarTimezoneUpgrade_setup

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def _calendarTimezoneUpgrade_setup(self):

        TimezoneCache.create()
        self.addCleanup(TimezoneCache.clear)

        tz1 = Component(None, pycalendar=readVTZ("Etc/GMT+1"))
        tz2 = Component(None, pycalendar=readVTZ("Etc/GMT+2"))
        tz3 = Component(None, pycalendar=readVTZ("Etc/GMT+3"))

        # Share user01 calendar with user03
        calendar = (yield self.calendarUnderTest(name="calendar_1", home="user01"))
        home3 = yield self.homeUnderTest(name="user03")
        shared_name = yield calendar.shareWith(home3, _BIND_MODE_WRITE)

        user_details = (
            ("user01", "calendar_1", tz1),
            ("user02", "calendar_1", tz2),
            ("user03", "calendar_1", None),
            ("user03", shared_name, tz3),
        )

        # Set dead properties on calendars
        for user, calname, tz in user_details:
            calendar = (yield self.calendarUnderTest(name=calname, home=user))
            if tz:
                calendar.properties()[PropertyName.fromElement(caldavxml.CalendarTimeZone)] = caldavxml.CalendarTimeZone.fromString(str(tz))

            # Force data version to previous
            home = (yield self.homeUnderTest(name=user))
            ch = home._homeSchema
            yield Update(
                {ch.DATAVERSION: 4},
                Where=ch.RESOURCE_ID == home._resourceID,
            ).on(self.transactionUnderTest())

        yield self.commit()

        for user, calname, tz in user_details:
            calendar = (yield self.calendarUnderTest(name=calname, home=user))
            self.assertEqual(calendar.getTimezone(), None)
            self.assertEqual(PropertyName.fromElement(caldavxml.CalendarTimeZone) in calendar.properties(), tz is not None)
        yield self.commit()

        # Create "fake" entry for non-existent share
        txn = self.transactionUnderTest()
        calendar = (yield self.calendarUnderTest(name="calendar_1", home="user01"))
        rp = schema.RESOURCE_PROPERTY
        yield Insert(
            {
                rp.RESOURCE_ID: calendar._resourceID,
                rp.NAME: PropertyName.fromElement(caldavxml.CalendarTimeZone).toString(),
                rp.VALUE: caldavxml.CalendarTimeZone.fromString(str(tz3)).toxml(),
                rp.VIEWER_UID: "user04",
            }
        ).on(txn)
        yield self.commit()

        returnValue(user_details)
开发者ID:eventable,项目名称:CalendarServer,代码行数:60,代码来源:test_upgrade_from_4_to_5.py

示例5: test_truncatedDec

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_truncatedDec(self):
        """
        Properties in components
        """
        TimezoneCache.create("")
        TimezoneCache.clear()

        self.doTest(
            "TruncatedDec10.ics",
            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True))
        )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:14,代码来源:test_timezones.py

示例6: test_truncatedDec

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_truncatedDec(self):
        """
        Custom VTZ valid from 2007. Daylight 2007 OK.
        """

        TimezoneCache.create(empty=True)
        TimezoneCache.clear()

        self.doTest(
            "TruncatedDec10.ics",
            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True))
        )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:15,代码来源:test_timezones.py

示例7: test_truncatedApr

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_truncatedApr(self):
        """
        Custom VTZ with truncated standard time - 2006. Daylight 2007 OK.
        """

        TimezoneCache.create(empty=True)
        TimezoneCache.clear()

        self.doTest(
            "TruncatedApr01.ics",
            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True))
        )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:15,代码来源:test_timezones.py

示例8: test_truncatedApr

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_truncatedApr(self):
        """
        Properties in components
        """
        
        TimezoneCache.create("")
        TimezoneCache.clear()

        self.doTest(
            "TruncatedApr01.ics",
            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True))
        )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:15,代码来源:test_timezones.py

示例9: __init__

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def __init__(self, records, populator, parameters, reactor, server,
                 principalPathTemplate, serializationPath, workerIndex=0, workerCount=1):
        self._records = records
        self.populator = populator
        self.reactor = reactor
        self.server = server
        self.principalPathTemplate = principalPathTemplate
        self.serializationPath = serializationPath
        self._pop = self.populator.populate(parameters)
        self._user = 0
        self._stopped = False
        self.workerIndex = workerIndex
        self.workerCount = workerCount
        self.clients = []

        TimezoneCache.create()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:18,代码来源:population.py

示例10: test_copyPackage_missingVersion

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_copyPackage_missingVersion(self):
        """
        Test that tz data is updated if the version is missing.
        """

        self.patch(config, "UsePackageTimezones", False)
        TimezoneCache.clear()
        TimezoneCache.create()

        self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo")))
        self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "version.txt")))
        os.remove(os.path.join(config.DataRoot, "zoneinfo", "version.txt"))
        self.assertFalse(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "version.txt")))

        TimezoneCache.create()
        self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "version.txt")))
开发者ID:eventable,项目名称:CalendarServer,代码行数:18,代码来源:test_timezones.py

示例11: test_truncatedAprThenDecOK

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_truncatedAprThenDecOK(self):
        """
        Properties in components
        """
        TimezoneCache.create()

        self.doTest(
            "TruncatedApr01.ics",
            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True)),
        )
        self.doTest(
            "TruncatedDec10.ics",
            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True)),
        )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:18,代码来源:test_timezones.py

示例12: test_truncatedAprThenDecOK

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_truncatedAprThenDecOK(self):
        """
        VTZ loaded from std timezone DB. 2007 OK.
        """

        TimezoneCache.create()

        self.doTest(
            "TruncatedApr01.ics",
            PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True)),
        )
        self.doTest(
            "TruncatedDec10.ics",
            PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
            PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True)),
        )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:19,代码来源:test_timezones.py

示例13: test_truncatedAprThenDecOK

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import create [as 别名]
    def test_truncatedAprThenDecOK(self):
        """
        VTZ loaded from std timezone DB. 2007 OK.
        """

        TimezoneCache.create()

        self.doTest(
            "TruncatedApr01.ics",
            DateTime(2007, 04, 01, 16, 0, 0, Timezone.UTCTimezone),
            DateTime(2007, 04, 01, 17, 0, 0, Timezone.UTCTimezone),
        )
        self.doTest(
            "TruncatedDec10.ics",
            DateTime(2007, 12, 10, 17, 0, 0, Timezone.UTCTimezone),
            DateTime(2007, 12, 10, 18, 0, 0, Timezone.UTCTimezone),
        )
开发者ID:eventable,项目名称:CalendarServer,代码行数:19,代码来源:test_timezones.py


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