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


Python TimezoneCache.getDBPath方法代码示例

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


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

示例1: testRead

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

        xmlfile = self.mktemp()
        db1 = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)
        db1.createNewDatabase()
        self.assertTrue(os.path.exists(xmlfile))

        db2 = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)
        db2.readDatabase()
        self.assertEqual(db1.dtstamp, db2.dtstamp)
        self.assertEqual(len(db1.timezones), len(db2.timezones))
开发者ID:eventable,项目名称:CalendarServer,代码行数:13,代码来源:test_timezonestdservice.py

示例2: _initPrimaryService

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import getDBPath [as 别名]
 def _initPrimaryService(self):
     tzpath = TimezoneCache.getDBPath()
     xmlfile = os.path.join(tzpath, "timezones.xml")
     self.timezones = PrimaryTimezoneDatabase(tzpath, xmlfile)
     if not os.path.exists(xmlfile):
         self.timezones.createNewDatabase()
     else:
         self.timezones.readDatabase()
     self.info_source = TimezoneCache.version
开发者ID:anemitz,项目名称:calendarserver,代码行数:11,代码来源:timezonestdservice.py

示例3: testCreate

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

        xmlfile = self.mktemp()
        db = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)

        db.createNewDatabase()
        self.assertTrue(os.path.exists(xmlfile))
        self.assertTrue(db.dtstamp is not None)
        self.assertTrue(len(db.timezones) > 0)
开发者ID:eventable,项目名称:CalendarServer,代码行数:11,代码来源:test_timezonestdservice.py

示例4: testGetNone

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

        xmlfile = self.mktemp()
        db = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)
        db.createNewDatabase()
        self.assertTrue(os.path.exists(xmlfile))

        tz = db.getTimezone("Bogus")
        self.assertEqual(tz, None)
开发者ID:eventable,项目名称:CalendarServer,代码行数:11,代码来源:test_timezonestdservice.py

示例5: testListChangedSince

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

        xmlfile = self.mktemp()
        db = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)
        db.createNewDatabase()
        self.assertTrue(os.path.exists(xmlfile))

        tzids = set([tz.tzid for tz in db.listTimezones(db.dtstamp)])
        self.assertTrue(len(tzids) == 0)
开发者ID:eventable,项目名称:CalendarServer,代码行数:11,代码来源:test_timezonestdservice.py

示例6: testList

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

        xmlfile = self.mktemp()
        db = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)
        db.createNewDatabase()
        self.assertTrue(os.path.exists(xmlfile))

        tzids = set([tz.tzid for tz in db.listTimezones(None)])
        self.assertTrue("America/New_York" in tzids)
        self.assertTrue("US/Eastern" not in tzids)
开发者ID:eventable,项目名称:CalendarServer,代码行数:12,代码来源:test_timezonestdservice.py

示例7: testUpdate

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

        xmlfile = self.mktemp()
        db = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)

        db.createNewDatabase()
        self.assertTrue(os.path.exists(xmlfile))

        db.updateDatabase()
        self.assertTrue(db.changeCount == 0)
        self.assertTrue(len(db.changed) == 0)
开发者ID:eventable,项目名称:CalendarServer,代码行数:13,代码来源:test_timezonestdservice.py

示例8: _initSecondaryService

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

        # Must have writeable paths
        tzpath = TimezoneCache.getDBPath()
        xmlfile = config.TimezoneService.XMLInfoPath
        if not xmlfile:
            xmlfile = os.path.join(tzpath, "timezones.xml")
        self.timezones = SecondaryTimezoneDatabase(tzpath, xmlfile, None)
        try:
            self.timezones.readDatabase()
        except:
            pass
        self.info_source = "Secondary"
        self.primary = False
开发者ID:anemitz,项目名称:calendarserver,代码行数:16,代码来源:timezonestdservice.py

示例9: testGetOne

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

        xmlfile = self.mktemp()
        db = PrimaryTimezoneDatabase(TimezoneCache.getDBPath(), xmlfile)
        db.createNewDatabase()
        self.assertTrue(os.path.exists(xmlfile))

        # Original
        tz1 = db.getTimezone("America/New_York")
        self.assertTrue(str(tz1).find("VTIMEZONE") != -1)
        self.assertTrue(str(tz1).find("TZID:America/New_York") != -1)

        # Alias
        tz1 = db.getTimezone("US/Eastern")
        self.assertTrue(str(tz1).find("VTIMEZONE") != -1)
        self.assertTrue(str(tz1).find("TZID:US/Eastern") != -1)
开发者ID:eventable,项目名称:CalendarServer,代码行数:18,代码来源:test_timezonestdservice.py

示例10: usage

# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import getDBPath [as 别名]
        sys.exit(1)

    if action is None:
        action = "list"
        primary = True
    if tzpath is None:
        if updatepkg:
            try:
                import pkg_resources
            except ImportError:
                tzpath = os.path.join(os.path.dirname(__file__), "zoneinfo")
            else:
                tzpath = pkg_resources.resource_filename("twistedcaldav", "zoneinfo") #@UndefinedVariable
        else:
            # Setup the correct zoneinfo path based on the config
            tzpath = TimezoneCache.getDBPath()
            TimezoneCache.validatePath()
    if xmlfile is None:
        xmlfile = os.path.join(tzpath, "timezones.xml")

    if primary and not os.path.isdir(tzpath):
        usage("Invalid zoneinfo path: %s" % (tzpath,))
    if primary and not os.path.isfile(xmlfile) and action != "create":
        usage("Invalid XML file path: %s" % (xmlfile,))

    if primary and secondary:
        usage("Cannot use primary and secondary options together")

    if primary:
        _doPrimaryActions(action, tzpath, xmlfile, changed, tzvers)
    else:
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:33,代码来源:managetimezones.py


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