core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'

This commit is contained in:
Goffi 2014-03-21 16:27:09 +01:00
commit 005ec59a8a
25 changed files with 123 additions and 101 deletions

View file

@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sat.core.i18n import _
from sat.core.constants import Const as C
from logging import debug, info, error
import warnings
warnings.filterwarnings('ignore', 'the MimeWriter', DeprecationWarning, 'twisted') # FIXME: to be removed, see http://twistedmatrix.com/trac/ticket/4038
@ -100,7 +101,7 @@ class MaildirBox(object):
self.accessMessageBox("INBOX", profile_key=profile).addMessage(message)
return False
def accessMessageBox(self, boxname, observer=None, profile_key='@DEFAULT@'):
def accessMessageBox(self, boxname, observer=None, profile_key=C.PROF_KEY_NONE):
"""Create and return a MailboxUser instance
@param boxname: name of the box
@param observer: method to call when a NewMessage arrive"""
@ -327,7 +328,7 @@ class MailboxUser(object):
mail['Subject'] = e.children[0].encode('utf-8')
return mail.as_string()
def __init__(self, _maildir, name, observer=None, profile="@NONE@"):
def __init__(self, _maildir, name, observer=None, profile=C.PROF_KEY_NONE):
"""@param _maildir: the main MaildirBox instance
@param name: name of the mailbox
@param profile: real profile (ie not a profile_key)