bika.health.obsolete   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 21
dl 0
loc 48
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A CustomPubPrefVocabulary.__call__() 0 8 2
1
# -*- coding: utf-8 -*-
2
#
3
# This file is part of SENAITE.HEALTH.
4
#
5
# SENAITE.HEALTH is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by the Free
7
# Software Foundation, version 2.
8
#
9
# This program is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
# details.
13
#
14
# You should have received a copy of the GNU General Public License along with
15
# this program; if not, write to the Free Software Foundation, Inc., 51
16
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
#
18
# Copyright 2018-2019 by it's authors.
19
# Some rights reserved, see README and LICENSE.
20
21
from bika.health import bikaMessageFactory as _
22
from bika.lims import deprecated
23
from zope.component import getAdapters
24
from zope.interface import Interface
25
from zope.interface import implements
26
from zope.schema.interfaces import IVocabularyFactory
27
from zope.schema.vocabulary import SimpleVocabulary
28
29
30
class ICustomPubPref(Interface):
31
    """Marker for custom Publication Preferences
32
    """
33
34
@deprecated("integration-1.3 artifact")
35
class CustomPubPrefVocabulary(object):
36
    implements(IVocabularyFactory)
37
38
    def __call__(self, context):
39
        items = [
40
            (_('Email'),'email'),
41
            (_('PDF'), 'pdf')
42
        ]
43
        for name, item in getAdapters((context, ), ICustomPubPref):
44
            items.append(item)
45
        return SimpleVocabulary.fromItems(items)
46
47
CustomPubPrefVocabularyFactory = CustomPubPrefVocabulary()
48