26 lines
908 B
Python
26 lines
908 B
Python
from zope import component
|
|
from plone.registry.interfaces import IRegistry
|
|
from interfaces import IThemisSettings
|
|
|
|
def get_document_type_for_mail(mail):
|
|
settings = component.getUtility(IRegistry).forInterface(IThemisSettings, False)
|
|
mapping = settings.mail_category_mapping
|
|
values = []
|
|
if mail.categorie_de_courrier:
|
|
values.extend(mail.categorie_de_courrier)
|
|
if mail.sous_categorie_de_courrier:
|
|
values.extend(mail.sous_categorie_de_courrier)
|
|
for line in mapping.splitlines():
|
|
if not line:
|
|
continue
|
|
if line.startswith('#'):
|
|
continue
|
|
category, object_type = line.strip().split(':')
|
|
if category in values:
|
|
return object_type
|
|
return None
|
|
|
|
def get_document_location_for_mail(mail):
|
|
settings = component.getUtility(IRegistry).forInterface(IThemisSettings, False)
|
|
return settings.documents_path
|