fixed imap dal __contains__ issue 1013, thanks Alan
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.0.9 (2012-09-17 08:57:56) stable
|
Version 2.0.9 (2012-09-17 09:12:09) stable
|
||||||
|
|||||||
+16
-6
@@ -5509,8 +5509,8 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
# mapped names (which native
|
# mapped names (which native
|
||||||
# mailbox has what table name)
|
# mailbox has what table name)
|
||||||
|
|
||||||
db.mailboxes <dict> # tablename, server native name
|
db.mailboxes <list> # DAL instance mailbox tablenames
|
||||||
db.mailbox_names <dict> # server native name, tablename
|
db.mailbox_names <dict> # tablename, server native name pairs
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -5813,8 +5813,10 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
Field("email", "string", writable=False, readable=False),
|
Field("email", "string", writable=False, readable=False),
|
||||||
Field("attachments", "list:string", writable=False, readable=False),
|
Field("attachments", "list:string", writable=False, readable=False),
|
||||||
)
|
)
|
||||||
|
# Set the db instance mailbox collections
|
||||||
return self.connection.mailbox_names
|
self.db.mailbox_names = self.connection.mailbox_names
|
||||||
|
self.db.mailboxes = self.connection.mailbox_names.keys()
|
||||||
|
return self.db.mailbox_names
|
||||||
|
|
||||||
def create_table(self, *args, **kwargs):
|
def create_table(self, *args, **kwargs):
|
||||||
# not implemented
|
# not implemented
|
||||||
@@ -6227,7 +6229,11 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
raise Exception("Operation not supported")
|
raise Exception("Operation not supported")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def NE(self, first, second):
|
def NE(self, first, second=None):
|
||||||
|
if (second is None) and isinstance(first, Field):
|
||||||
|
# All records special table query
|
||||||
|
if first.type == "id":
|
||||||
|
return self.GE(first, 1)
|
||||||
result = self.NOT(self.EQ(first, second))
|
result = self.NOT(self.EQ(first, second))
|
||||||
result = result.replace("NOT NOT", "").strip()
|
result = result.replace("NOT NOT", "").strip()
|
||||||
return result
|
return result
|
||||||
@@ -7150,7 +7156,11 @@ def index():
|
|||||||
return table
|
return table
|
||||||
|
|
||||||
def __contains__(self, tablename):
|
def __contains__(self, tablename):
|
||||||
return tablename in self.tables
|
try:
|
||||||
|
return tablename in self.tables
|
||||||
|
except AttributeError:
|
||||||
|
# The instance has no .tables attribute yet
|
||||||
|
return False
|
||||||
|
|
||||||
def get(self,key,default):
|
def get(self,key,default):
|
||||||
return self.__dict__.get(key,default)
|
return self.__dict__.get(key,default)
|
||||||
|
|||||||
Reference in New Issue
Block a user