[PDB-tech] Country Code "XK"

LOOS Eric (BCS/CBU) eric.loos at bics.com
Thu May 5 22:13:21 PDT 2016


Thanks Matt,

Had been looking at COUNTIES_OVERRIDE but it complained about the _ indeed, so decided to just add it. If it is that easy, we can get away with updating the documentation.

Kind regards,

Eric Loos


-----Original Message-----
From: Matt Griswold [mailto:grizz at 20c.com]
Sent: Friday 6 May 2016 07:11
To: LOOS Eric (BCS/CBU)
Cc: pdb-tech at lists.peeringdb.com
Subject: Re: [PDB-tech] Country Code "XK"

* "LOOS Eric (BCS/CBU)" <eric.loos at bics.com> [160506 04:59 +0000]:
> True enough, but I came across this issue when I was trying to use the
> django-peeringdb code, it relies on django_countries, which is using
> ONLY ISO approved country-codes. I did a quick hack an added XK to it
> (+ XK mapping to UNK, numeric 900) UNK = under supervision of united
> nations, 900-999: numeric range reserved for user defined situations.
>From how I read it, using XK in this case is one of the reasons
ISO-3166 has user defined codes, specifying a new country before ISO officially adds it. According to wikipedia, it's used by "European Commission, Switzerland, the Deutsche Bundesbank and other organisations."

> So our only option to make django_peeringdb work out of the box if we
> want to keep non-ISO country codes is to create a new CountryField
> from the one supplied by django_countries, which has a filter
> accepting these private ranges. The API docs do show 'XK' as a choice.
An easier way to deal with it is to add the following to your settings:

    # add user defined iso code for Kosovo
    COUNTRIES_OVERRIDE={
         'XK': _('Kosovo'),
    },

If you're not using _ for tranlastions, add:

    _ = lambda s: s

or remove _()

>From https://github.com/peeringdb/peeringdb-py/blob/master/peeringdb/localdb.py#L87

We should probably add a note to that for django-peeringdb as well.

________________________________

**** DISCLAIMER****
http://www.bics.com/maildisclaimer/


More information about the Pdb-tech mailing list