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


Python PropertyName.fromString方法代码示例

本文整理汇总了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)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:36,代码来源:schedule.py

示例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])
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:10,代码来源:sql.py

示例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
     )
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:11,代码来源:common.py

示例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)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:24,代码来源:resource.py

示例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)
开发者ID:eventable,项目名称:CalendarServer,代码行数:6,代码来源:sql.py

示例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")
开发者ID:eventable,项目名称:CalendarServer,代码行数:7,代码来源:test_base.py


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