[web test] add basic windmill tests and documentation
- connection / deconnection
- user creation
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## 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/>.""""""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