本文整理汇总了Python中txdav.base.propertystore.base.PropertyName.fromString方法的典型用法代码示例。如果您正苦于以下问题:Python PropertyName.fromString方法的具体用法?Python PropertyName.fromString怎么用?Python PropertyName.fromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txdav.base.propertystore.base.PropertyName
的用法示例。
在下文中一共展示了PropertyName.fromString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readProperty
# 需要导入模块: from txdav.base.propertystore.base import PropertyName [as 别名]
# 或者: from txdav.base.propertystore.base.PropertyName import fromString [as 别名]
def readProperty(self, property, request):
if type(property) is tuple:
qname = property
else:
qname = property.qname()
if qname == (caldav_namespace, "calendar-free-busy-set"):
# Always return at least an empty list
if not self.hasDeadProperty(property):
top = self.parent.url()
values = []
for cal in self.parent._newStoreHome.calendars():
prop = cal.properties().get(PropertyName.fromString(ScheduleCalendarTransp.sname()))
if prop == ScheduleCalendarTransp(Opaque()):
values.append(HRef(joinURL(top, cal.name())))
returnValue(CalendarFreeBusySet(*values))
elif qname == (caldav_namespace, "schedule-default-calendar-URL"):
# Must have a valid default
try:
defaultCalendarProperty = self.readDeadProperty(property)
except HTTPError:
defaultCalendarProperty = None
if defaultCalendarProperty and len(defaultCalendarProperty.children) == 1:
defaultCalendar = str(defaultCalendarProperty.children[0])
cal = (yield request.locateResource(str(defaultCalendar)))
if cal is not None and cal.exists() and isCalendarCollectionResource(cal):
returnValue(defaultCalendarProperty)
# Default is not valid - we have to try to pick one
defaultCalendarProperty = (yield self.pickNewDefaultCalendar(request))
returnValue(defaultCalendarProperty)
result = (yield super(ScheduleInboxResource, self).readProperty(property, request))
returnValue(result)
示例2: _keys_uid
# 需要导入模块: from txdav.base.propertystore.base import PropertyName [as 别名]
# 或者: from txdav.base.propertystore.base.PropertyName import fromString [as 别名]
def _keys_uid(self, uid):
rows = self._txn.execSQL(
"select NAME from RESOURCE_PROPERTY where "
"VIEWER_UID = %s and RESOURCE_ID = %s",
[uid, self._resourceID]
)
for row in rows:
yield PropertyName.fromString(row[0])
示例3: checkProperties
# 需要导入模块: from txdav.base.propertystore.base import PropertyName [as 别名]
# 或者: from txdav.base.propertystore.base.PropertyName import fromString [as 别名]
def checkProperties():
addressbookProperties = (yield home.addressbookWithName(name)).properties()
addressbookType = ResourceType.addressbook #@UndefinedVariable
self.assertEquals(
addressbookProperties[
PropertyName.fromString(ResourceType.sname())
],
addressbookType
)
示例4: readProperty
# 需要导入模块: from txdav.base.propertystore.base import PropertyName [as 别名]
# 或者: from txdav.base.propertystore.base.PropertyName import fromString [as 别名]
def readProperty(self, property, request):
if type(property) is tuple:
qname = property
else:
qname = property.qname()
if qname == caldavxml.CalendarFreeBusySet.qname():
# Always return at least an empty list
if not self.hasDeadProperty(property):
top = self.parent.url()
values = []
for cal in (yield self.parent._newStoreHome.calendars()):
prop = cal.properties().get(PropertyName.fromString(ScheduleCalendarTransp.sname()))
if prop == ScheduleCalendarTransp(Opaque()):
values.append(HRef(joinURL(top, cal.name())))
returnValue(CalendarFreeBusySet(*values))
elif qname in (caldavxml.ScheduleDefaultCalendarURL.qname(), customxml.ScheduleDefaultTasksURL.qname()):
result = (yield self.readDefaultCalendarProperty(request, qname))
returnValue(result)
result = (yield super(ScheduleInboxResource, self).readProperty(property, request))
returnValue(result)
示例5: _keys_uid
# 需要导入模块: from txdav.base.propertystore.base import PropertyName [as 别名]
# 或者: from txdav.base.propertystore.base.PropertyName import fromString [as 别名]
def _keys_uid(self, uid):
for cachedKey, cachedUID in self._cached.keys():
if cachedUID == uid:
yield PropertyName.fromString(cachedKey)
示例6: test_fromString
# 需要导入模块: from txdav.base.propertystore.base import PropertyName [as 别名]
# 或者: from txdav.base.propertystore.base.PropertyName import fromString [as 别名]
def test_fromString(self):
name = PropertyName.fromString("{http://calendarserver.org/}bleargh")
self.assertEquals(name.namespace, "http://calendarserver.org/")
self.assertEquals(name.name, "bleargh")