@requires_rw
    def edit_asn(self, auth, asn, attr):

        self._logger.debug("edit_asn called; asn: %s attr: %s" %
                (str(asn), str(attr)))

        # sanity check - do we have all attributes?
        req_attr = [ ]
        allowed_attr = [ 'name', ]
        self._check_attr(attr, req_attr, allowed_attr)

        asns = self.list_asn(auth, asn)

        where, params1 = self._expand_asn_spec(asn)
        update, params2 = self._sql_expand_update(attr)
        params = dict(params2.items() + params1.items())

        sql = "UPDATE ip_net_asn SET " + update + " WHERE " + where
        sql += " RETURNING *"

        self._execute(sql, params)
        updated_asns = []
        for row in self._curs_pg:
            updated_asns.append(dict(row))

        # write to audit table
        for a in asns:
            audit_params = {
                'username': auth.username,
                'authenticated_as': auth.authenticated_as,
                'full_name': auth.full_name,
                'authoritative_source': auth.authoritative_source
            }
            audit_params['description'] = 'Edited ASN %s attr: %s' % (str(a['asn']), str(attr))

            sql, params = self._sql_expand_insert(audit_params)
            self._execute('INSERT INTO ip_net_log %s' % sql, params)

        return updated_asns
Edit AS number
dataset/ETHPy150Open SpriteLink/NIPAP/nipap/nipap/backend.py/Nipap.edit_asn