Exemplo n.º 1
0
 def test_moved(self):
     module = 'data.deprecation'
     any_func = deprecation.moved(module, 'moving_target')
     any_func()
     self.assertEqual(
         self.messages,
         ['object moving_target has been moved to module data.deprecation'])
 def test_moved(self):
     module = 'data.deprecation'
     any_func = deprecation.moved(module, 'moving_target')
     any_func()
 def test_moved(self):
     module = 'data.deprecation'
     any_func = deprecation.moved(module, 'moving_target')
     any_func()
     self.assertEqual(self.messages,
                      ['object moving_target has been moved to module data.deprecation'])
Exemplo n.º 4
0
 def test_moved(self):
     # this test needs l.c.test.__init__
     module = 'logilab.common.test.unittest_deprecation'
     any_func = deprecation.moved(module, 'moving_target')
     any_func()
Exemplo n.º 5
0
 def test_moved(self):
     # this test needs l.c.test.__init__
     module = 'logilab.common.test.unittest_deprecation'
     any_func = deprecation.moved(module, 'moving_target')
     any_func()
Exemplo n.º 6
0
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:[email protected]
#
# This file is part of CubicWeb.
#
# CubicWeb is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
"""contains utility functions and some visual component to restrict results of
a search

"""

from logilab.common.deprecation import moved

insert_attr_select_relation = moved('cubicweb.web.facet',
                                    'insert_attr_select_relation')
Exemplo n.º 7
0
 def test_moved(self):
     module = 'data.deprecation'
     any_func = deprecation.moved(module, 'moving_target')
     any_func()
Exemplo n.º 8
0
 def test_moved(self):
     module = "data.deprecation"
     any_func = deprecation.moved(module, "moving_target")
     any_func()
     self.assertEqual(self.messages, ["object moving_target has been moved to module data.deprecation"])
Exemplo n.º 9
0
    from logilab.common.adbh import get_adv_func_helper
    mod.adv_func_helper = get_adv_func_helper(driver)
    return mod

def get_connection(driver='postgres', host='', database='', user='',
                  password='', port='', quiet=False, drivers=PREFERED_DRIVERS,
                  pywrap=False, extra_args=None):
    """return a db connection according to given arguments"""
    module, modname = _import_driver_module(driver, drivers, ['connect'])
    try:
        adapter = ADAPTER_DIRECTORY.get_adapter(driver, modname)
    except NoAdapterFound, err:
        if not quiet:
            msg = 'No Adapter found for %s, using default one' % err.objname
            print >> sys.stderr, msg
        adapted_module = DBAPIAdapter(module, pywrap)
    else:
        adapted_module = adapter(module, pywrap)
    if host and not port:
        try:
            host, port = host.split(':', 1)
        except ValueError:
            pass
    if port:
        port = int(port)
    return adapted_module.connect(host, database, user, password, port=port, extra_args=extra_args)


from logilab.common.deprecation import moved
get_adv_func_helper = moved('logilab.common.adbh', 'get_adv_func_helper')