src/pyams_thesaurus/include.py
changeset 0 47700a43ef3f
child 4 5dc0c1fa6af6
equal deleted inserted replaced
-1:000000000000 0:47700a43ef3f
       
     1 #
       
     2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 
       
    20 # import packages
       
    21 
       
    22 
       
    23 def include_package(config):
       
    24     """Pyramid include"""
       
    25 
       
    26     # add translations
       
    27     config.add_translation_dirs('pyams_thesaurus:locales')
       
    28 
       
    29     # define JSON-RPC endpoint
       
    30     config.add_jsonrpc_endpoint('thesaurus', '/api/thesaurus/json')
       
    31 
       
    32     # load registry components
       
    33     try:
       
    34         import pyams_zmi
       
    35     except ImportError:
       
    36         config.scan(ignore='pyams_thesaurus.zmi')
       
    37     else:
       
    38         config.scan()
       
    39 
       
    40     if hasattr(config, 'load_zcml'):
       
    41         config.load_zcml('configure.zcml')