[CalendarServer-changes] [5752] CalendarServer/branches/new-store/txcaldav/calendarstore
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 16 00:44:01 PDT 2010
Revision: 5752
http://trac.macosforge.org/projects/calendarserver/changeset/5752
Author: glyph at apple.com
Date: 2010-06-16 00:43:58 -0700 (Wed, 16 Jun 2010)
Log Message:
-----------
don't expose temporary directories as separate calendars
Modified Paths:
--------------
CalendarServer/branches/new-store/txcaldav/calendarstore/file.py
CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py
Modified: CalendarServer/branches/new-store/txcaldav/calendarstore/file.py
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/file.py 2010-06-16 07:43:14 UTC (rev 5751)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/file.py 2010-06-16 07:43:58 UTC (rev 5752)
@@ -72,6 +72,10 @@
return not name.startswith(".")
+def _hidden(path):
+ return path.sibling('.' + path.basename())
+
+
_unset = object()
class _cached(object):
@@ -359,7 +363,7 @@
if name not in self._removedCalendars and childPath.isdir():
raise CalendarAlreadyExistsError(name)
- temporary = childPath.temporarySibling()
+ temporary = _hidden(childPath.temporarySibling())
temporary.createDirectory()
# In order for the index to work (which is doing real file ops on disk
# via SQLite) we need to create a real directory _immediately_.
@@ -706,7 +710,7 @@
def do():
backup = None
if self._path.exists():
- backup = self._path.temporarySibling()
+ backup = _hidden(self._path.temporarySibling())
self._path.moveTo(backup)
fh = self._path.open("w")
try:
Modified: CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py 2010-06-16 07:43:14 UTC (rev 5751)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py 2010-06-16 07:43:58 UTC (rev 5752)
@@ -618,6 +618,18 @@
)
+ def test_calendarsAfterAddCalendar(self):
+ """
+ L{ICalendarHome.calendars} includes calendars recently added with
+ L{ICalendarHome.createCalendarWithName}.
+ """
+ home = self.homeUnderTest()
+ before = set(x.name() for x in home.calendars())
+ home.createCalendarWithName("new-name")
+ after = set(x.name() for x in home.calendars())
+ self.assertEquals(before | set(['new-name']), after)
+
+
def test_createCalendarObjectWithName_absent(self):
"""
L{ICalendar.createCalendarObjectWithName} creates a new
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100616/4cad4b9d/attachment-0001.html>
More information about the calendarserver-changes
mailing list