Projet

Général

Profil

0001-Add-get_backends-function.patch

Benjamin Dauvergne, 04 mars 2015 14:50

Télécharger (1,22 ko)

Voir les différences:

Subject: [PATCH] Add get_backends() function

 eopayment/__init__.py |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
eopayment/__init__.py
5 5
from common import URL, HTML
6 6

  
7 7
__all__ = ['Payment', 'URL', 'HTML', '__version__', 'SIPS', 'SYSTEMPAY',
8
           'SPPLUS', 'DUMMY', 'get_backend']
8
           'SPPLUS', 'DUMMY', 'get_backend', 'get_backends']
9 9

  
10 10
__version__ = "0.0.22"
11 11

  
......
22 22
    module = __import__(kind, globals(), locals(), [])
23 23
    return module.Payment
24 24

  
25
__BACKENDS = [ DUMMY, SIPS, SYSTEMPAY, SPPLUS ]
26

  
27
def get_backends():
28
    '''Return a dictionnary mapping existing eopayment backends name to their
29
       description.
30

  
31
          >>> get_backends()['dummy'].description['caption']
32
          'Dummy payment backend'
33

  
34
    '''
35
    return {backend: get_backend(backend) for backend in __BACKENDS}
25 36

  
26 37
class Payment(object):
27 38
    '''
28
-