[CalendarServer-changes] [10888] CalendarServer/branches/users/gaya/directorybacker/twistedcaldav/ directory/opendirectorybacker.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 11 14:17:10 PDT 2013
Revision: 10888
http://trac.calendarserver.org//changeset/10888
Author: gaya at apple.com
Date: 2013-03-11 14:17:10 -0700 (Mon, 11 Mar 2013)
Log Message:
-----------
fix white space
Modified Paths:
--------------
CalendarServer/branches/users/gaya/directorybacker/twistedcaldav/directory/opendirectorybacker.py
Modified: CalendarServer/branches/users/gaya/directorybacker/twistedcaldav/directory/opendirectorybacker.py
===================================================================
--- CalendarServer/branches/users/gaya/directorybacker/twistedcaldav/directory/opendirectorybacker.py 2013-03-11 20:54:57 UTC (rev 10887)
+++ CalendarServer/branches/users/gaya/directorybacker/twistedcaldav/directory/opendirectorybacker.py 2013-03-11 21:17:10 UTC (rev 10888)
@@ -56,6 +56,8 @@
addSourceProperty = False
+
+
class OpenDirectoryBackingService(DirectoryService):
"""
Directory backer for L{IDirectoryService}.
@@ -63,12 +65,15 @@
baseGUID = "BF07A1A2-5BB5-4A4D-A59A-67260EA7E143"
+
def __repr__(self):
return "<%s %r>" % (self.__class__.__name__, self.realmName,)
+
def __init__(self, params):
self._actuallyConfigure(**params)
+
def _actuallyConfigure(
self, queryPeopleRecords=True,
peopleNode="/Search/Contacts",
@@ -239,6 +244,7 @@
def createCache(self):
succeed(None)
+
def _isSystemRecord(self, recordShortName, recordAttributes):
recordType = recordAttributes.get(dsattributes.kDSNAttrRecordType)
@@ -270,6 +276,7 @@
Get a dictionary of ABDirectoryQueryResult by enumerating the local directory
"""
+
def generateDSLocalResults():
resultsDictionary = {}
@@ -488,6 +495,7 @@
Get vCards for a given addressBookFilter and addressBookQuery
"""
+
def allowedRecordTypes():
constantProperties = ABDirectoryQueryResult.constantProperties.copy()
@@ -628,6 +636,8 @@
@param constantProperties: a mapping of constant properties. A query on a constant property will return all or None
@return: (filterProperyNames, expressions) tuple. expression==True means list all results, expression==False means no results
"""
+
+
def propFilterListQuery(filterAllOf, propFilters):
def combineExpressionLists(expressionList, allOf, addedExpressions):
@@ -674,6 +684,7 @@
@return: (filterProperyNames, expressions) tuple. expression==True means list all results, expression==False means no results
"""
+
def definedExpression(defined, allOf):
if constant or propFilter.filter_name in ("N" , "FN", "UID", "SOURCE",):
return defined # all records have this property so no records do not have it
@@ -699,7 +710,7 @@
#end andOrExpression()
- def paramFilterElementExpression(propFilterAllOf, paramFilterElement):
+ def paramFilterElementExpression(propFilterAllOf, paramFilterElement): #@UnusedVariable
params = ABDirectoryQueryResult.vcardPropToParamMap.get(propFilter.filter_name.upper())
defined = params and paramFilterElement.filter_name.upper() in params
@@ -719,6 +730,7 @@
def textMatchElementExpression(propFilterAllOf, textMatchElement):
+
# pre process text match strings for ds query
def getMatchStrings(propFilter, matchString):
@@ -1115,7 +1127,7 @@
self.kind = kind.lower()
- #generate a vCard here. May throw an exception
+ #generate a vCard here. May throw an exception
self.vCard()
@@ -1127,6 +1139,7 @@
self.vCard().propertyValue("UID")
)
+
def __hash__(self):
s = "".join([
"%s:%s" % (attribute, self.valuesForAttribute(attribute),)
@@ -1165,6 +1178,7 @@
else:
return values.encode("utf_8") if isinstance(values, unicode) else values
+
def joinedValuesForAttribute(self, attributeName, separator=",", default_string=""):
values = self.valuesForAttribute(attributeName, None)
if not values:
@@ -1201,6 +1215,7 @@
return False
return True
+
def addUniqueProperty(vcard, newProperty, ignoreParams=None, attrType=None, attrValue=None):
if isUniqueProperty(vcard, newProperty, ignoreParams):
vcard.addProperty(newProperty)
@@ -1208,12 +1223,14 @@
if attrType and attrValue:
self.log_info("Ignoring attribute %r with value %r in creating property %r. A duplicate property already exists." % (attrType, attrValue, newProperty,))
+
def addPropertyAndLabel(groupCount, label, propertyName, propertyValue, parameters=None):
groupCount[0] += 1
groupPrefix = "item%d" % groupCount[0]
vcard.addProperty(Property(propertyName, propertyValue, params=parameters, group=groupPrefix))
vcard.addProperty(Property("X-ABLabel", label, group=groupPrefix))
+
# for attributes of the form param:value
def addPropertiesAndLabelsForPrefixedAttribute(groupCount, propertyPrefix, propertyName, attrType, defaultLabel, nolabelParamTypes=(), labelMap={}, specialParamType=None):
preferred = True
@@ -1724,12 +1741,15 @@
return self._vCard
+
def vCardText(self):
return str(self.vCard())
+
def uri(self):
return self.vCard().propertyValue("UID") + ".vcf"
+
def hRef(self, parentURI=None):
return davxml.HRef.fromString(joinURL(parentURI if parentURI else self._directoryBackedAddressBook.uri, self.uri()))
@@ -1793,7 +1813,8 @@
return self._directoryBackedAddressBook.readProperty(property, request)
- def listProperties(self, request):
+
+ def listProperties(self, request): #@UnusedVariable
qnames = set(self.liveProperties())
# Add dynamic live properties that exist
@@ -1812,6 +1833,7 @@
listProperties = deferredGenerator(listProperties)
+
# utility
#remove illegal XML
def removeControlChars(utf8String):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130311/7ad4e8bb/attachment.html>
More information about the calendarserver-changes
mailing list