本文整理汇总了Python中twistedcaldav.timezones.TimezoneCache.validatePath方法的典型用法代码示例。如果您正苦于以下问题:Python TimezoneCache.validatePath方法的具体用法?Python TimezoneCache.validatePath怎么用?Python TimezoneCache.validatePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twistedcaldav.timezones.TimezoneCache
的用法示例。
在下文中一共展示了TimezoneCache.validatePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: usage
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import validatePath [as 别名]
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:
_doSecondaryActions(action, tzpath, xmlfile, url)