@requires_rw<EOL><INDENT>def remove_prefix(self, auth, spec, recursive = False):<DEDENT>
self._logger.debug("<STR_LIT>" % unicode(spec))<EOL>if '<STR_LIT:id>' in spec:<EOL><INDENT>p = self.list_prefix(auth, spec)[<NUM_LIT:0>]<EOL>del spec['<STR_LIT:id>']<EOL>spec['<STR_LIT>'] = p['<STR_LIT>']<EOL>spec['<STR_LIT>'] = p['<STR_LIT>']<EOL><DEDENT>elif '<STR_LIT>' in spec:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise NipapMissingInputError('<STR_LIT>')<EOL><DEDENT>prefixes = self.list_prefix(auth, spec)<EOL>if recursive:<EOL><INDENT>spec['<STR_LIT:type>'] = '<STR_LIT:host>'<EOL>self._db_remove_prefix(spec, recursive)<EOL>del spec['<STR_LIT:type>']<EOL>self._db_remove_prefix(spec, recursive)<EOL><DEDENT>else:<EOL><INDENT>self._db_remove_prefix(spec)<EOL><DEDENT>audit_params = {<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>}<EOL>for p in prefixes:<EOL><INDENT>audit_params['<STR_LIT>'] = p['<STR_LIT:id>']<EOL>audit_params['<STR_LIT>'] = p['<STR_LIT>']<EOL>audit_params['<STR_LIT:description>'] = '<STR_LIT>' % p['<STR_LIT>']<EOL>audit_params['<STR_LIT>'] = p['<STR_LIT>']<EOL>audit_params['<STR_LIT>'] = p['<STR_LIT>']<EOL>audit_params['<STR_LIT>'] = p['<STR_LIT>']<EOL>sql, params = self._sql_expand_insert(audit_params)<EOL>self._execute('<STR_LIT>' % sql, params)<EOL>if p['<STR_LIT>'] is not None:<EOL><INDENT>pool = self._get_pool(auth, { '<STR_LIT:id>': p['<STR_LIT>'] })<EOL>audit_params2 = {<EOL>'<STR_LIT>': pool['<STR_LIT:id>'],<EOL>'<STR_LIT>': pool['<STR_LIT:name>'],<EOL>'<STR_LIT>': p['<STR_LIT:id>'],<EOL>'<STR_LIT>': p['<STR_LIT>'],<EOL>'<STR_LIT:description>': '<STR_LIT>' % (p['<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>}<EOL>sql, params = self._sql_expand_insert(audit_params2)<EOL>self._execute('<STR_LIT>' % sql, params)<EOL><DEDENT><DEDENT>
Remove prefix matching `spec`.

            * `auth` [BaseAuth]
                AAA options.
            * `spec` [prefix_spec]
                Specifies prefixe to remove.
            * `recursive` [bool]
                When set to True, also remove child prefixes.

            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.remove_prefix` for full
            understanding.