dabo Commit
Revision 6253
Date: 2010-12-17 13:16:13 -0800 (Fri, 17 Dec 2010)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6253
Changed:
U trunk/dabo/dEvents.py
U trunk/dabo/dObject.py
U trunk/dabo/dPref.py
Log:
Improved dictionary objects handling.
Diff:
Modified: trunk/dabo/dEvents.py
===================================================================
--- trunk/dabo/dEvents.py 2010-12-17 19:28:02 UTC (rev 6252)
+++ trunk/dabo/dEvents.py 2010-12-17 21:16:13 UTC (rev 6253)
@@ -61,7 +61,7 @@
eventData["timestamp"] = time.localtime()
# Add any keyword args passed:
- for key in kwargs.keys():
+ for key in kwargs:
eventData[key] = kwargs[key]
# Add native event data:
@@ -69,7 +69,7 @@
# Each UI lib should implement getEventData()
uiEventData = dabo.ui.getEventData(nativeEvent)
- for key in uiEventData.keys():
+ for key in uiEventData:
eventData[key] = uiEventData[key]
self._eventData = eventData
Modified: trunk/dabo/dObject.py
===================================================================
--- trunk/dabo/dObject.py 2010-12-17 19:28:02 UTC (rev 6252)
+++ trunk/dabo/dObject.py 2010-12-17 21:16:13 UTC (rev 6253)
@@ -84,7 +84,7 @@
properties = self._extractKeywordProperties(kwargs,
self._properties)
if kwargs:
# Some kwargs haven't been handled.
- bad = ", ".join(["'%s'" % kk for kk in kwargs.keys()])
+ bad = ", ".join(["'%s'" % kk for kk in kwargs])
raise TypeError("Invalid keyword arguments passed to
%s: %s" % (self.__repr__(), bad))
if self._call_afterInit:
Modified: trunk/dabo/dPref.py
===================================================================
--- trunk/dabo/dPref.py 2010-12-17 19:28:02 UTC (rev 6252)
+++ trunk/dabo/dPref.py 2010-12-17 21:16:13 UTC (rev 6253)
@@ -247,7 +247,7 @@
else:
self._persist(key, val)
# Handle the cached deletions
- for key in self._deletionCache.keys():
+ for key in self._deletionCache:
self._cursor.execute("delete from daboprefs where ckey
like ? ", (key, ))
self._deletionCache = {}
self._cursor.commitTransaction()
@@ -367,11 +367,9 @@
tmpDict = {}
for rec in rs:
tmpDict[rec["ckey"][keylen:keylen+len(rec["ckey"].split(".")[keydots])]] = None
- ret = tmpDict.keys()
# Now add any cached entries
- addl = [kk for kk in self._cache.keys()
- if kk not in ret and kk.startswith(key) and not
isinstance(kk, dPref)]
- ret += addl
+ ret = list(set(tmpDict) | set([kk for kk in self._cache
+ if kk.startswith(key) and not isinstance(kk, dPref)]))
return ret
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]