[CalendarServer-changes] [5988] CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore /postgres.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 5 13:42:58 PDT 2010
Revision: 5988
http://trac.macosforge.org/projects/calendarserver/changeset/5988
Author: glyph at apple.com
Date: 2010-08-05 13:42:57 -0700 (Thu, 05 Aug 2010)
Log Message:
-----------
IDataStoreResource and notifier stub implementations
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py
Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py 2010-08-05 20:24:58 UTC (rev 5987)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py 2010-08-05 20:42:57 UTC (rev 5988)
@@ -20,29 +20,36 @@
"""
__all__ = [
- "CalendarStore",
- "CalendarHome",
- "Calendar",
- "CalendarObject",
+ "PostgresCalendarStore",
+ "PostgresCalendarHome",
+ "PostgresCalendar",
+ "PostgresCalendarObject",
]
from inspect import getargspec
+from zope.interface.declarations import implements
from twisted.python.modules import getModule
from twisted.application.service import Service
-from txcaldav.calendarstore.util import validateCalendarComponent,\
- dropboxIDFromCalendarObject
-from txdav.common.icommondatastore import ObjectResourceNameAlreadyExistsError,\
- HomeChildNameAlreadyExistsError, NoSuchHomeChildError,\
- NoSuchObjectResourceError
+
from txdav.idav import IDataStore, AlreadyFinishedError
-from zope.interface.declarations import implements
-from txcaldav.icalendarstore import ICalendarTransaction, ICalendarHome, \
- ICalendar, ICalendarObject
+
+from txdav.common.icommondatastore import (
+ ObjectResourceNameAlreadyExistsError, HomeChildNameAlreadyExistsError,
+ NoSuchHomeChildError, NoSuchObjectResourceError)
+from txcaldav.calendarstore.util import (validateCalendarComponent,
+ dropboxIDFromCalendarObject)
+
+
+from txcaldav.icalendarstore import (ICalendarTransaction, ICalendarHome,
+ ICalendar, ICalendarObject)
from txdav.propertystore.base import AbstractPropertyStore, PropertyName
-from twext.web2.dav.element.parser import WebDAVDocument
from txdav.propertystore.none import PropertyStore
+from twext.web2.http_headers import MimeType
+from twext.web2.dav.element.parser import WebDAVDocument
+
+
from twext.python.vcomponent import VComponent
@@ -253,8 +260,30 @@
def removeAttachmentWithName(self, name):
pass
+ # IDataStoreResource
+ def contentType(self):
+ """
+ The content type of Calendar objects is text/calendar.
+ """
+ return MimeType.fromString("text/calendar")
+ def md5(self):
+ return None
+
+
+ def size(self):
+ return 0
+
+
+ def created(self):
+ return None
+
+
+ def modified(self):
+ return None
+
+
class PostgresCalendar(object):
implements(ICalendar)
@@ -271,9 +300,14 @@
return self._home._txn._cursor
+ def notifierID(self, label="default"):
+ return None
+
+
def name(self):
return self._name
+
def rename(self, name):
oldName = self._name
c = self._cursor()
@@ -350,13 +384,14 @@
c.execute(
"""
insert into CALENDAR_OBJECT
- (CALENDAR_RESOURCE_ID, RESOURCE_NAME, ICALENDAR_TEXT, ICALENDAR_UID,
- ICALENDAR_TYPE, ATTACHMENTS_MODE)
+ (CALENDAR_RESOURCE_ID, RESOURCE_NAME, ICALENDAR_TEXT,
+ ICALENDAR_UID, ICALENDAR_TYPE, ATTACHMENTS_MODE)
values
(%s, %s, %s, %s, %s, %s)
""",
- # should really be filling out more fields: ORGANIZER, ORGANIZER_OBJECT,
- # a correct ATTACHMENTS_MODE based on X-APPLE-DROPBOX
+ # should really be filling out more fields: ORGANIZER,
+ # ORGANIZER_OBJECT, a correct ATTACHMENTS_MODE based on X-APPLE-
+ # DROPBOX
[self._resourceID, name, componentText, component.resourceUID(),
component.resourceType(), _ATTACHMENTS_MODE_WRITE]
)
@@ -414,7 +449,31 @@
)
+ # IDataStoreResource
+ def contentType(self):
+ """
+ The content type of Calendar objects is text/calendar.
+ """
+ return MimeType.fromString("text/calendar")
+
+ def md5(self):
+ return None
+
+
+ def size(self):
+ return 0
+
+
+ def created(self):
+ return None
+
+
+ def modified(self):
+ return None
+
+
+
class PostgresCalendarHome(object):
implements(ICalendarHome)
@@ -435,6 +494,13 @@
return self._ownerUID
+ def name(self):
+ """
+ Implement L{IDataStoreResource.name} to return the uid.
+ """
+ return self.uid()
+
+
def calendars(self):
"""
Retrieve calendars contained in this calendar home.
@@ -538,7 +604,35 @@
)
+ # IDataStoreResource
+ def contentType(self):
+ """
+ The content type of Calendar objects is text/calendar.
+ """
+ return MimeType.fromString("text/calendar")
+
+ def md5(self):
+ return None
+
+
+ def size(self):
+ return 0
+
+
+ def created(self):
+ return None
+
+
+ def modified(self):
+ return None
+
+
+ def notifierID(self, label="default"):
+ return None
+
+
+
class PostgresCalendarTransaction(object):
"""
Transaction implementation for postgres database.
@@ -602,7 +696,14 @@
raise AlreadyFinishedError()
+ def postCommit(self):
+ """
+ Run things after 'commit.'
+ """
+ # FIXME: implement.
+
+
class PostgresStore(Service, object):
implements(IDataStore)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100805/2793a137/attachment-0001.html>
More information about the calendarserver-changes
mailing list