Merge pull request #241 from spametki/master
IMAP fixed patch for google code issue 1707
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
||||||
'(something like "it-it")': '(algo como "it-it")',
|
'(something like "it-it")': '(algo como "it-it")',
|
||||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
||||||
|
'@markmin\x01An error occured, please [[reload %s]] the page': 'An error occured, please [[reload %s]] the page',
|
||||||
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
||||||
'A new version of web2py is available': 'Hay una nueva versión de web2py disponible',
|
'A new version of web2py is available': 'Hay una nueva versión de web2py disponible',
|
||||||
'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
|
'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
'appadmin': 'appadmin',
|
'appadmin': 'appadmin',
|
||||||
'appadmin is disabled because insecure channel': 'admin deshabilitado, el canal no es seguro',
|
'appadmin is disabled because insecure channel': 'admin deshabilitado, el canal no es seguro',
|
||||||
'application "%s" uninstalled': 'aplicación "%s" desinstalada',
|
'application "%s" uninstalled': 'aplicación "%s" desinstalada',
|
||||||
|
'application %(appname)s installed with md5sum: %(digest)s': 'application %(appname)s installed with md5sum: %(digest)s',
|
||||||
'application compiled': 'aplicación compilada',
|
'application compiled': 'aplicación compilada',
|
||||||
'application is compiled and cannot be designed': 'la aplicación está compilada y no puede ser modificada',
|
'application is compiled and cannot be designed': 'la aplicación está compilada y no puede ser modificada',
|
||||||
'Application name:': 'Application name:',
|
'Application name:': 'Application name:',
|
||||||
@@ -92,6 +94,7 @@
|
|||||||
'Create new application using the Wizard': 'Create new application using the Wizard',
|
'Create new application using the Wizard': 'Create new application using the Wizard',
|
||||||
'create new application:': 'nombre de la nueva aplicación:',
|
'create new application:': 'nombre de la nueva aplicación:',
|
||||||
'Create new simple application': 'Cree una nueva aplicación',
|
'Create new simple application': 'Cree una nueva aplicación',
|
||||||
|
'Create/Upload': 'Create/Upload',
|
||||||
'created by': 'creado por',
|
'created by': 'creado por',
|
||||||
'crontab': 'crontab',
|
'crontab': 'crontab',
|
||||||
'Current request': 'Solicitud en curso',
|
'Current request': 'Solicitud en curso',
|
||||||
|
|||||||
+14
-6
@@ -6124,7 +6124,7 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
else:
|
else:
|
||||||
return (uid_list[0], uid_list[-1])
|
return (uid_list[0], uid_list[-1])
|
||||||
|
|
||||||
def convert_date(self, date, add=None):
|
def convert_date(self, date, add=None, imf=False):
|
||||||
if add is None:
|
if add is None:
|
||||||
add = datetime.timedelta()
|
add = datetime.timedelta()
|
||||||
""" Convert a date object to a string
|
""" Convert a date object to a string
|
||||||
@@ -6138,7 +6138,10 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
if isinstance(date, basestring):
|
if isinstance(date, basestring):
|
||||||
# Prevent unexpected date response format
|
# Prevent unexpected date response format
|
||||||
try:
|
try:
|
||||||
dayname, datestring = date.split(",")
|
if "," in date:
|
||||||
|
dayname, datestring = date.split(",")
|
||||||
|
else:
|
||||||
|
dayname, datestring = None, date
|
||||||
date_list = datestring.strip().split()
|
date_list = datestring.strip().split()
|
||||||
year = int(date_list[2])
|
year = int(date_list[2])
|
||||||
month = months.index(date_list[1].upper())
|
month = months.index(date_list[1].upper())
|
||||||
@@ -6150,8 +6153,10 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
LOGGER.error("Could not parse date text: %s. %s" %
|
LOGGER.error("Could not parse date text: %s. %s" %
|
||||||
(date, e))
|
(date, e))
|
||||||
return None
|
return None
|
||||||
elif isinstance(date, (datetime.datetime, datetime.date)):
|
elif isinstance(date, (datetime.date, datetime.datetime)):
|
||||||
return (date + add).strftime("%d-%b-%Y")
|
if imf: date_format = "%a, %d %b %Y %H:%M:%S %z"
|
||||||
|
else: date_format = "%d-%b-%Y"
|
||||||
|
return (date + add).strftime(date_format)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -6532,7 +6537,8 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
|
|
||||||
mailbox = table.mailbox
|
mailbox = table.mailbox
|
||||||
d = dict(((k.name, v) for k, v in fields))
|
d = dict(((k.name, v) for k, v in fields))
|
||||||
date_time = (d.get("created", datetime.datetime.now())).timetuple()
|
date_time = d.get("created", datetime.datetime.now())
|
||||||
|
struct_time = date_time.timetuple()
|
||||||
if len(d) > 0:
|
if len(d) > 0:
|
||||||
message = d.get("email", None)
|
message = d.get("email", None)
|
||||||
attachments = d.get("attachments", [])
|
attachments = d.get("attachments", [])
|
||||||
@@ -6547,6 +6553,8 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
message = Message()
|
message = Message()
|
||||||
message["from"] = d.get("sender", "")
|
message["from"] = d.get("sender", "")
|
||||||
message["subject"] = d.get("subject", "")
|
message["subject"] = d.get("subject", "")
|
||||||
|
message["date"] = self.convert_date(date_time, imf=True)
|
||||||
|
|
||||||
if mime:
|
if mime:
|
||||||
message.set_type(mime)
|
message.set_type(mime)
|
||||||
if charset:
|
if charset:
|
||||||
@@ -6569,7 +6577,7 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
[add_payload(message, c) for c in content]
|
[add_payload(message, c) for c in content]
|
||||||
[add_payload(message, a) for a in attachments]
|
[add_payload(message, a) for a in attachments]
|
||||||
message = message.as_string()
|
message = message.as_string()
|
||||||
return (mailbox, flags, date_time, message)
|
return (mailbox, flags, struct_time, message)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("IMAP empty insert is not implemented")
|
raise NotImplementedError("IMAP empty insert is not implemented")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user