[CalendarServer-changes] [9131] CalendarServer/trunk/calendarserver/tools/shell
source_changes at macosforge.org
source_changes at macosforge.org
Mon Apr 16 15:34:53 PDT 2012
Revision: 9131
http://trac.macosforge.org/projects/calendarserver/changeset/9131
Author: wsanchez at apple.com
Date: 2012-04-16 15:34:52 -0700 (Mon, 16 Apr 2012)
Log Message:
-----------
Folder.list() has returning duplicate entries in cases where
Folder.child() cached a result from instantiating a class in
self._childClasses into self._children.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/shell/cmd.py
CalendarServer/trunk/calendarserver/tools/shell/vfs.py
Modified: CalendarServer/trunk/calendarserver/tools/shell/cmd.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/cmd.py 2012-04-16 22:11:20 UTC (rev 9130)
+++ CalendarServer/trunk/calendarserver/tools/shell/cmd.py 2012-04-16 22:34:52 UTC (rev 9131)
@@ -151,16 +151,23 @@
if filter is None:
filter = lambda item: True
+ token = tokens[-1]
+
+ if "/" in token:
+ raise NotImplementedError()
+ else:
+ base = self.wd
+
files = (
entry.toString()
- for entry in (yield self.wd.list())
+ for entry in (yield base.list())
if filter(entry)
)
if len(tokens) == 0:
returnValue(files)
else:
- returnValue(self.complete(tokens[-1], files))
+ returnValue(self.complete(token, files))
class Commands(CommandsBase):
Modified: CalendarServer/trunk/calendarserver/tools/shell/vfs.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2012-04-16 22:11:20 UTC (rev 9130)
+++ CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2012-04-16 22:34:52 UTC (rev 9131)
@@ -204,12 +204,13 @@
raise NotFoundError("Folder %r has no child %r" % (str(self), name))
def list(self):
- result = set()
+ result = {}
for name in self._children:
- result.add(ListEntry(self, self._children[name].__class__, name))
+ result[name] = ListEntry(self, self._children[name].__class__, name)
for name in self._childClasses:
- result.add(ListEntry(self, self._childClasses[name], name))
- return succeed(result)
+ if name not in result:
+ result[name] = ListEntry(self, self._childClasses[name], name)
+ return succeed(result.itervalues())
class RootFolder(Folder):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120416/2738d434/attachment-0001.html>
More information about the calendarserver-changes
mailing list