[PEP8] mail_environment
parent
71e9ffb564
commit
cc2dbd6c85
|
@ -26,8 +26,10 @@
|
||||||
'description': """
|
'description': """
|
||||||
Extend mail and fetch mail with server environment module.
|
Extend mail and fetch mail with server environment module.
|
||||||
|
|
||||||
In config files, sections outgoint_mail and incoming_mails are default values for all Outgoing Mail Servers and Fetchmail Servers.
|
In config files, sections outgoint_mail and incoming_mails are default values
|
||||||
For each server, you can (re)define values with a section named "outgoing_mail.resource_name" where resource_name is the name of your server.
|
for all Outgoing Mail Servers and Fetchmail Servers.
|
||||||
|
For each server, you can (re)define values with a section named
|
||||||
|
"outgoing_mail.resource_name" where resource_name is the name of your server.
|
||||||
|
|
||||||
Exemple of config file :
|
Exemple of config file :
|
||||||
|
|
||||||
|
@ -64,4 +66,3 @@ password = openerp
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'active': False,
|
'active': False,
|
||||||
}
|
}
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
||||||
|
|
|
@ -52,34 +52,39 @@ class IrMail(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'smtp_host': fields.function(_get_smtp_conf,
|
'smtp_host': fields.function(
|
||||||
|
_get_smtp_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='SMTP Server',
|
string='SMTP Server',
|
||||||
type="char",
|
type="char",
|
||||||
multi='outgoing_mail_config',
|
multi='outgoing_mail_config',
|
||||||
size=128),
|
size=128),
|
||||||
'smtp_port': fields.function(_get_smtp_conf,
|
'smtp_port': fields.function(
|
||||||
|
_get_smtp_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='SMTP Port',
|
string='SMTP Port',
|
||||||
type="integer",
|
type="integer",
|
||||||
multi='outgoing_mail_config',
|
multi='outgoing_mail_config',
|
||||||
help="SMTP Port. Usually 465 for SSL, and 25 or 587 for other cases.",
|
help="SMTP Port. Usually 465 for SSL, and 25 or 587 for other cases.",
|
||||||
size=5),
|
size=5),
|
||||||
'smtp_user': fields.function(_get_smtp_conf,
|
'smtp_user': fields.function(
|
||||||
|
_get_smtp_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Username',
|
string='Username',
|
||||||
type="char",
|
type="char",
|
||||||
multi='outgoing_mail_config',
|
multi='outgoing_mail_config',
|
||||||
help="Optional username for SMTP authentication",
|
help="Optional username for SMTP authentication",
|
||||||
size=64),
|
size=64),
|
||||||
'smtp_pass': fields.function(_get_smtp_conf,
|
'smtp_pass': fields.function(
|
||||||
|
_get_smtp_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Password',
|
string='Password',
|
||||||
type="char",
|
type="char",
|
||||||
multi='outgoing_mail_config',
|
multi='outgoing_mail_config',
|
||||||
help="Optional password for SMTP authentication",
|
help="Optional password for SMTP authentication",
|
||||||
size=64),
|
size=64),
|
||||||
'smtp_encryption' :fields.function(_get_smtp_conf,
|
'smtp_encryption': fields.function(
|
||||||
|
_get_smtp_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='smtp_encryption',
|
string='smtp_encryption',
|
||||||
type="char",
|
type="char",
|
||||||
|
@ -108,13 +113,15 @@ class FetchmailServer(osv.osv):
|
||||||
key_types = {'port': int,
|
key_types = {'port': int,
|
||||||
'is_ssl': lambda a: bool(int(a)),
|
'is_ssl': lambda a: bool(int(a)),
|
||||||
'attach': lambda a: bool(int(a)),
|
'attach': lambda a: bool(int(a)),
|
||||||
'original': lambda a: bool(int(a)),}
|
'original': lambda a: bool(int(a)),
|
||||||
|
}
|
||||||
|
|
||||||
# default vals
|
# default vals
|
||||||
config_vals = {'port': 993,
|
config_vals = {'port': 993,
|
||||||
'is_ssl': 0,
|
'is_ssl': 0,
|
||||||
'attach': 0,
|
'attach': 0,
|
||||||
'original': 0}
|
'original': 0,
|
||||||
|
}
|
||||||
if serv_config.has_section(global_section_name):
|
if serv_config.has_section(global_section_name):
|
||||||
config_vals.update(serv_config.items(global_section_name))
|
config_vals.update(serv_config.items(global_section_name))
|
||||||
|
|
||||||
|
@ -152,19 +159,22 @@ class FetchmailServer(osv.osv):
|
||||||
return [('id', 'in', result_ids)]
|
return [('id', 'in', result_ids)]
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'server': fields.function(_get_incom_conf,
|
'server': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Server',
|
string='Server',
|
||||||
type="char",
|
type="char",
|
||||||
multi='income_mail_config',
|
multi='income_mail_config',
|
||||||
size=256, help="Hostname or IP of the mail server"),
|
size=256, help="Hostname or IP of the mail server"),
|
||||||
'port': fields.function(_get_incom_conf,
|
'port': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Port',
|
string='Port',
|
||||||
type="integer",
|
type="integer",
|
||||||
multi='income_mail_config',
|
multi='income_mail_config',
|
||||||
help="Hostname or IP of the mail server"),
|
help="Hostname or IP of the mail server"),
|
||||||
'type': fields.function(_get_incom_conf,
|
'type': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Type',
|
string='Type',
|
||||||
type="char",
|
type="char",
|
||||||
|
@ -172,34 +182,41 @@ class FetchmailServer(osv.osv):
|
||||||
fnct_search=_type_search,
|
fnct_search=_type_search,
|
||||||
size=64,
|
size=64,
|
||||||
help="pop, imap, local"),
|
help="pop, imap, local"),
|
||||||
'is_ssl': fields.function(_get_incom_conf,
|
'is_ssl': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Is SSL',
|
string='Is SSL',
|
||||||
type="boolean",
|
type="boolean",
|
||||||
multi='income_mail_config',
|
multi='income_mail_config',
|
||||||
help='Connections are encrypted with SSL/TLS through'
|
help='Connections are encrypted with SSL/TLS through'
|
||||||
' a dedicated port (default: IMAPS=993, POP3S=995)'),
|
' a dedicated port (default: IMAPS=993, POP3S=995)'),
|
||||||
'attach': fields.function(_get_incom_conf,
|
'attach': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Keep Attachments',
|
string='Keep Attachments',
|
||||||
type="boolean",
|
type="boolean",
|
||||||
multi='income_mail_config',
|
multi='income_mail_config',
|
||||||
help="Whether attachments should be downloaded. "
|
help="Whether attachments should be downloaded. "
|
||||||
"If not enabled, incoming emails will be stripped of any attachments before being processed"),
|
"If not enabled, incoming emails will be stripped of any "
|
||||||
'original': fields.function(_get_incom_conf,
|
"attachments before being processed"),
|
||||||
|
'original': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Keep Original',
|
string='Keep Original',
|
||||||
type="boolean",
|
type="boolean",
|
||||||
multi='income_mail_config',
|
multi='income_mail_config',
|
||||||
help="Whether a full original copy of each email should be kept for reference"
|
help="Whether a full original copy of each email should be kept "
|
||||||
"and attached to each processed message. This will usually double the size of your message database."),
|
"for reference and attached to each processed message. This "
|
||||||
'user': fields.function(_get_incom_conf,
|
"will usually double the size of your message database."),
|
||||||
|
'user': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='Username',
|
string='Username',
|
||||||
type="char",
|
type="char",
|
||||||
multi='income_mail_config',
|
multi='income_mail_config',
|
||||||
size=64),
|
size=64),
|
||||||
'password': fields.function(_get_incom_conf,
|
'password': fields.function(
|
||||||
|
_get_incom_conf,
|
||||||
method=True,
|
method=True,
|
||||||
string='password',
|
string='password',
|
||||||
type="char",
|
type="char",
|
||||||
|
|
Loading…
Reference in New Issue