Changeset 12060 for main/waeup.ikoba


Ignore:
Timestamp:
25 Nov 2014, 18:44:01 (10 years ago)
Author:
uli
Message:

Merge changes from uli-payments back into trunk.

Location:
main/waeup.ikoba/trunk
Files:
1 deleted
15 edited
9 copied

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk

  • main/waeup.ikoba/trunk/docs/INSTALL.txt

    r11954 r12060  
    11Installation of Ikoba
    2 ####################
     2#####################
    33
    44These are generic installation instructions for the WAeUP_ ``Ikoba``
     
    88file.
    99
    10 Please note, that **only Linux-based installs** are described and actively
    11 supported. We recommend use of Debian_ / Ubuntu_.
     10Please note, that **only Linux-based installs** are described and
     11actively supported. We recommend use of Debian_ / Ubuntu_.
    1212
    1313.. note:: This means we do not actively support Windows(tm)!
     
    1919*************
    2020
    21 The Ikoba packages are based on `Grok`_, which is a Python_
    22 framework for agile webapplication development. Grok_ itself is based
    23 on `Zope`_.
     21The Ikoba packages are based on `Grok`_, which is a Python_ framework
     22for agile webapplication development. Grok_ itself is based on
     23`Zope`_.
    2424
    2525Both, Grok_ and Zope_, are written in the `Python`_ programming
     
    4646* XML and XSLT development libraries (``libxml2-dev``, ``libxslt1-dev``)
    4747
     48* The "Foreign Function Interface Library" (FFI, ``libffi-dev``) because
     49  it is needed by the paypal Python SDK
     50
    4851* enscript (``enscript``) [optional]
    4952
     
    5356
    5457  $ sudo apt-get install python2.7 python2.7-dev subversion \
    55                          build-essential enscript libxml2-dev libxslt1-dev
     58                         build-essential enscript libxml2-dev libxslt1-dev \
     59                         libffi-dev
    5660
    5761Afterwards you should be able to enter::
  • main/waeup.ikoba/trunk/docs/source/developerdocs/api/api_meta.rst

    r11949 r12060  
    11`meta` -- Ikoba Components Grokkers Module
    2 *****************************************
     2******************************************
    33
    44.. automodule:: waeup.ikoba.meta
  • main/waeup.ikoba/trunk/docs/source/developerdocs/api/api_payments.rst

    r11949 r12060  
    1818   :maxdepth: 1
    1919
    20    payments/api_payment
    2120   payments/api_container
    2221   payments/api_interfaces
     22   payments/api_payment
     23   payments/api_paypal
  • main/waeup.ikoba/trunk/etc

    • Property svn:ignore set to
      paypal.conf
      paypal-testing.conf


  • main/waeup.ikoba/trunk/etc/site.zcml.in

    r11949 r12060  
    2727  <ikoba:datacenter
    2828      path="${buildout:directory}/var/datacenter" />
     29
     30  <!-- Where can the Paypal config be found? -->
     31  <ikoba:paypalconf
     32      path="${buildout:directory}/etc/paypal.conf" />
    2933
    3034    <configure i18n_domain="${ikoba_params:devel_pkg}">
  • main/waeup.ikoba/trunk/setup.py

    r11954 r12060  
    4141    'zc.async[z3]',
    4242    'z3c.evalexception',
     43    'paypalrestsdk',
    4344    ],
    4445
  • main/waeup.ikoba/trunk/src/waeup/ikoba

  • main/waeup.ikoba/trunk/src/waeup/ikoba/ftesting.zcml

    r11949 r12060  
    1414  <ikoba:datacenter
    1515      path="../../../parts/test/datacenter" />
     16
     17  <!-- Where can the Paypal config be found? -->
     18  <ikoba:paypalconf
     19      path="../../../etc/paypal-testing.conf" />
    1620
    1721  <!-- Typical functional testing security setup -->
  • main/waeup.ikoba/trunk/src/waeup/ikoba/interfaces.py

    r12032 r12060  
    11371137        )
    11381138
     1139
     1140class IPayPalConfig(Interface):
     1141    path = Path(
     1142        title = u'Path',
     1143        description = u"Path to config file for PayPal REST API.",
     1144        required = True,
     1145        )
     1146
     1147
    11391148#
    11401149# Asynchronous job handling and related
  • main/waeup.ikoba/trunk/src/waeup/ikoba/meta.zcml

    r11949 r12060  
    1717      />
    1818
     19  <meta:directive
     20      namespace="http://namespaces.waeup.org/ikoba"
     21      name="paypalconf"
     22      schema=".zcml.IPayPalConfig"
     23      handler=".zcml.paypal_conf"
     24      />
    1925
    2026</configure>
  • main/waeup.ikoba/trunk/src/waeup/ikoba/utils/tests/test_utils.py

    r11997 r12060  
    2929
    3030    def setUp(self):
    31         self.max_pmem = psutil.phymem_usage().total
    3231        self.max_vmem = psutil.virtual_memory().total
    3332        self.max_smem = psutil.swap_memory().total
     
    124123        utils.SYSTEM_MAX_LOAD['virt-mem'] = -(sys.maxint)  # negative int
    125124        assert utils.expensive_actions_allowed() == False
    126 
    127     def test_expensive_actions_allowed_physmem_none(self):
    128         # unset physmem maximum values make KofUtils ignore physmem values
    129         utils = self.get_cleared_util()
    130         utils.SYSTEM_MAX_LOAD['phys-mem'] = None
    131         assert utils.expensive_actions_allowed() == True
    132         # even not-set values won't block us
    133         del utils.SYSTEM_MAX_LOAD['phys-mem']
    134         assert utils.expensive_actions_allowed() == True
    135 
    136     @unittest.skipIf(
    137         psutil.phymem_usage().percent >= 99.99,
    138         reason="System physmem use over 99%. Cannot set higher allowed value.")
    139     def test_expensive_actions_allowed_physmem_ok(self):
    140         # We can react to high physmem values
    141         max_mem = psutil.phymem_usage().total
    142         utils = self.get_cleared_util()
    143         utils.SYSTEM_MAX_LOAD['phys-mem'] = 99.99          # positive float
    144         assert utils.expensive_actions_allowed() == True
    145         utils.SYSTEM_MAX_LOAD['phys-mem'] = -0.01          # negative float
    146         assert utils.expensive_actions_allowed() == True
    147         utils.SYSTEM_MAX_LOAD['phys-mem'] = max_mem        # positive int
    148         assert utils.expensive_actions_allowed() == True
    149         utils.SYSTEM_MAX_LOAD['phys-mem'] = -1             # negative int
    150         assert utils.expensive_actions_allowed() == True
    151 
    152     @unittest.skipIf(
    153         not psutil.phymem_usage().percent,
    154         reason="Can test physmem behavior only if actually using some")
    155     def test_expensive_actions_allowed_physmem_too_much(self):
    156         # We can react if too much physmem is used
    157         max_mem = psutil.phymem_usage().total
    158         utils = self.get_cleared_util()
    159         utils.SYSTEM_MAX_LOAD['phys-mem'] = 0.0            # positive float
    160         assert utils.expensive_actions_allowed() == False
    161         utils.SYSTEM_MAX_LOAD['phys-mem'] = -100.0         # negative float
    162         assert utils.expensive_actions_allowed() == False
    163         utils.SYSTEM_MAX_LOAD['phys-mem'] = 0              # positive int
    164         assert utils.expensive_actions_allowed() == False
    165         utils.SYSTEM_MAX_LOAD['phys-mem'] = -(max_mem)     # negative int
    166         assert utils.expensive_actions_allowed() == False
  • main/waeup.ikoba/trunk/src/waeup/ikoba/utils/utils.py

    r12053 r12060  
    125125    #: value. `cpu-load`, of course, accepts float values only.
    126126    #: `swap-mem` = Swap Memory, `virt-mem` = Virtual Memory,
    127     #: `phys-mem` = Physical Memory, `cpu-load` = CPU load in percent.
     127    #: `cpu-load` = CPU load in percent.
    128128    SYSTEM_MAX_LOAD = {
    129129        'swap-mem': None,
    130130        'virt-mem': None,
    131         'phys-mem': None,
    132131        'cpu-load': 100.0,
    133132        }
     
    247246            ('swap-mem', psutil.swap_memory),
    248247            ('virt-mem', psutil.virtual_memory),
    249             ('phys-mem', psutil.phymem_usage),
    250248            ):
    251249            max_val = max_values.get(key, None)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/zcml.py

    r11949 r12060  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
     18import os
    1819from zope.component.zcml import handler
    19 from waeup.ikoba.interfaces import IDataCenterConfig
     20from zope.configuration.exceptions import ConfigurationError
     21from waeup.ikoba.interfaces import IDataCenterConfig, IPayPalConfig
     22from waeup.ikoba.payments.paypal import configure_sdk
     23
    2024
    2125def data_center_conf(context, path):
     
    4448    """
    4549    context.action(
    46         discriminator = ('utility', IDataCenterConfig, ''),
    47         callable = handler,
    48         args = ('registerUtility',
    49                 {'path':path}, IDataCenterConfig, '')
     50        discriminator=('utility', IDataCenterConfig, ''),
     51        callable=handler,
     52        args=('registerUtility',
     53              {'path': path}, IDataCenterConfig, '')
    5054        )
     55
     56
     57def paypal_handler(path):
     58    """ZCML handler that registers paypal configuration.
     59
     60    We expect paypal credentials written down in a config file. The
     61    path to this config file can be set with the ZCML `paypalconf`
     62    directive, which is handled here and looks like this::
     63
     64      <ikoba:paypalconf path='/some/path/to/paypal.conf' />
     65
     66    This handler requires the given path to exist and to be a file.
     67
     68    If the file exists and is readable, a dict with ``path`` and other
     69    values read from the configuration file is registered as a global
     70    unnamed utility for the `IPayPalConfig` interface.
     71
     72    See :func:`waeup.ikoba.payments.paypal.configure_sdk for details
     73    of the set dict.
     74    """
     75    if not os.path.exists(path):
     76        raise ConfigurationError("No such file: %s" % path)
     77    if not os.path.isfile(path):
     78        raise ConfigurationError("Not a regular file: %s" % path)
     79    config_dict = configure_sdk(path)
     80    return handler(
     81        'registerUtility', config_dict, IPayPalConfig, '')
     82
     83
     84def paypal_conf(context, path):
     85    """Handler for ZCML paypalconf directive.
     86
     87    This handler registers the `paypal_handler` above to perform the
     88    real configuration action.
     89    """
     90    context.action(
     91        discriminator=('utility', IPayPalConfig, ''),
     92        callable=paypal_handler,
     93        args=(path, )
     94        )
  • main/waeup.ikoba/trunk/versions.cfg

    r11949 r12060  
    77
    88[versions]
     9setuptools = 7.0
    910collective.recipe.sphinxbuilder = 0.7.0
    1011collective.recipe.template = 1.10
     
    156157lxml = 3.3.1
    157158
    158 # Added by buildout at 2014-09-19 13:29:39.427594
    159 
    160159# Required by:
    161160# waeup.ikoba==1.3dev
    162161psutil = 2.1.1
     162six = 1.5.2
     163# Added by buildout at 2014-11-18 17:09:18.443792
     164cffi = 0.8.6
     165cryptography = 0.6.1
     166pyOpenSSL = 0.14
     167
     168# Required by:
     169# waeup.ikoba==0.2dev
     170paypalrestsdk = 1.6.1
     171
     172# Required by:
     173# cffi==0.8.6
     174pycparser = 2.10
     175
     176# Required by:
     177# paypalrestsdk==1.6.1
     178requests = 2.4.3
Note: See TracChangeset for help on using the changeset viewer.