@requires_rw<EOL><INDENT>def edit_asn(self, auth, asn, attr):<DEDENT>
self._logger.debug("<STR_LIT>" %<EOL>(unicode(asn), unicode(attr)))<EOL>req_attr = [ ]<EOL>allowed_attr = [ '<STR_LIT:name>', ]<EOL>self._check_attr(attr, req_attr, allowed_attr)<EOL>asns = self.list_asn(auth, asn)<EOL>where, params1 = self._expand_asn_spec(asn)<EOL>update, params2 = self._sql_expand_update(attr)<EOL>params = dict(params2.items() + params1.items())<EOL>sql = "<STR_LIT>" + update + "<STR_LIT>" + where<EOL>sql += "<STR_LIT>"<EOL>self._execute(sql, params)<EOL>updated_asns = []<EOL>for row in self._curs_pg:<EOL><INDENT>updated_asns.append(dict(row))<EOL><DEDENT>for a in asns:<EOL><INDENT>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>audit_params['<STR_LIT:description>'] = '<STR_LIT>' % (unicode(a['<STR_LIT>']), unicode(attr))<EOL>sql, params = self._sql_expand_insert(audit_params)<EOL>self._execute('<STR_LIT>' % sql, params)<EOL><DEDENT>return updated_asns<EOL>
Edit AS number

            * `auth` [BaseAuth]
                AAA options.
            * `asn` [integer]
                AS number to edit.
            * `attr` [asn_attr]
                New AS attributes.

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