ignore some internal warnings
prevent the display of warnings caused by the definition of deprecated functions
so that the output of cubicweb-ctl is not polluted.
""":organization: Logilab:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses"""fromAccessControlimportgetSecurityManagerfromcubicweb.dbapiimportconnect,Connection,Cursorfromcubicweb.common.utilsimportResultSet,ResultSetIterator,ResultSetRow,EntityConnection.__allow_access_to_unprotected_subobjects__=1Cursor.__allow_access_to_unprotected_subobjects__=1ResultSet.__allow_access_to_unprotected_subobjects__=1ResultSetIterator.__allow_access_to_unprotected_subobjects__=1ResultSetRow.__allow_access_to_unprotected_subobjects__=1Entity.__allow_access_to_unprotected_subobjects__=1CNX_CACHE={}defget_connection(context,user=None,password=None,host=None,database=None,group='cubicweb'):"""get a connection on an cubicweb server"""request=context.REQUESTzope_user=getSecurityManager().getUser()ifuserisNone:user=zope_user.getId()key=(user,host,database)try:returnCNX_CACHE[key]exceptKeyError:ifpasswordisNone:password=zope_user._getPassword()cnx=connect(user,password,host,database,group)CNX_CACHE[key]=cnxreturncnx