@requires_rw<EOL><INDENT>def add_pool(self, auth, attr):<DEDENT>
self._logger.debug("<STR_LIT>" % unicode(attr))<EOL>req_attr = ['<STR_LIT:name>', '<STR_LIT:description>', '<STR_LIT>']<EOL>self._check_pool_attr(attr, req_attr)<EOL>insert, params = self._sql_expand_insert(attr)<EOL>sql = "<STR_LIT>" + insert<EOL>self._execute(sql, params)<EOL>pool_id = self._lastrowid()<EOL>pool = self.list_pool(auth, { '<STR_LIT:id>': pool_id })[<NUM_LIT:0>]<EOL>audit_params = {<EOL>'<STR_LIT>': pool['<STR_LIT:id>'],<EOL>'<STR_LIT>': pool['<STR_LIT:name>'],<EOL>'<STR_LIT:username>': auth.username,<EOL>'<STR_LIT>': auth.authenticated_as,<EOL>'<STR_LIT>': auth.full_name,<EOL>'<STR_LIT>': auth.authoritative_source,<EOL>'<STR_LIT:description>': '<STR_LIT>' % (pool['<STR_LIT:name>'], unicode(attr))<EOL>}<EOL>sql, params = self._sql_expand_insert(audit_params)<EOL>self._execute('<STR_LIT>' % sql, params)<EOL>return pool<EOL>
Create a pool according to `attr`.

            * `auth` [BaseAuth]
                AAA options.
            * `attr` [pool_attr]
                A dict containing the attributes the new pool should have.

            Returns a dict describing the pool which was added.

            This is the documentation of the internal backend function. It's
            exposed over XML-RPC, please also see the XML-RPC documentation for
            :py:func:`nipap.xmlrpc.NipapXMLRPC.add_pool` for full
            understanding.