[CalendarServer-changes] [2628] CalendarServer/branches/users/cdaboo/sqlpropstore-2623/twistedcaldav /sqlprops.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jun 26 11:25:57 PDT 2008
Revision: 2628
http://trac.macosforge.org/projects/calendarserver/changeset/2628
Author: cdaboo at apple.com
Date: 2008-06-26 11:25:56 -0700 (Thu, 26 Jun 2008)
Log Message:
-----------
Clean-up.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/sqlpropstore-2623/twistedcaldav/sqlprops.py
Modified: CalendarServer/branches/users/cdaboo/sqlpropstore-2623/twistedcaldav/sqlprops.py
===================================================================
--- CalendarServer/branches/users/cdaboo/sqlpropstore-2623/twistedcaldav/sqlprops.py 2008-06-26 18:24:42 UTC (rev 2627)
+++ CalendarServer/branches/users/cdaboo/sqlpropstore-2623/twistedcaldav/sqlprops.py 2008-06-26 18:25:56 UTC (rev 2628)
@@ -19,7 +19,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
##
-from uuid import uuid4
"""
DAV Property store using an sqlite database.
@@ -43,11 +42,11 @@
A dead property store that uses an SQLite database back end.
"""
- def __init__(self, resource, use_cache=True):
+ def __init__(self, resource):
self.resource = resource
if os.path.exists(os.path.dirname(resource.fp.path)):
if resource.isCollection():
- self.childindex = SQLPropertiesDatabase(resource.fp.path, use_cache)
+ self.childindex = SQLPropertiesDatabase(resource.fp.path, True)
else:
self.childindex = None
@@ -56,11 +55,12 @@
self.rname = ""
self.index = self.childindex
else:
+ # Try to re-use the childindex of the parent resource if one can be found.
self.rname = os.path.basename(resource.fp.path)
if hasattr(self.resource, "parent_resource"):
self.index = self.resource.parent_resource.deadProperties().childindex
else:
- self.index = SQLPropertiesDatabase(os.path.dirname(resource.fp.path), use_cache)
+ self.index = SQLPropertiesDatabase(os.path.dirname(resource.fp.path), True)
else:
log.err("No sqlPropertyStore file for %s" % (os.path.dirname(resource.fp.path),))
self.index = None
@@ -249,6 +249,8 @@
dbFilename = ".db.sqlproperties"
dbFormatVersion = "1"
+ _debug_instance = 1
+
@classmethod
def _encodePropertyName(cls, name):
return "{%s}%s" % name
@@ -291,7 +293,12 @@
self.use_cache = use_cache
self.cache = {}
- self.instance = uuid4()
+
+ _instance = SQLPropertiesDatabase._debug_instance
+ SQLPropertiesDatabase._debug_instance += 1
+ #self.instance = "%s - %s" % (path[105:-len(SQLPropertiesDatabase.dbFilename)], _instance,)
+ self.instance = "%s" % (_instance,)
+ log.debug("[%s]: Created instance" % (self.instance,))
def cacheAllChildProperties(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080626/078ed8a0/attachment-0001.htm
More information about the calendarserver-changes
mailing list