File: settings.py

package info (click to toggle)
django-countries 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,524 kB
  • sloc: python: 1,096; makefile: 30; sh: 22
file content (22 lines) | stat: -rw-r--r-- 607 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
from django.conf import settings


def _build_flag_url():
    if hasattr(settings, 'COUNTRIES_FLAG_URL'):
        url = settings.COUNTRIES_FLAG_URL
    else:
        url = 'flags/%(code)s.gif'
    prefix = getattr(settings, 'STATIC_URL', '') or settings.MEDIA_URL
    if not prefix.endswith('/'):
        prefix = '%s/' % prefix
    return '%s%s' % (prefix, url)

def _build_iso_xml():
    if hasattr(settings, 'COUNTRIES_ISO_XML'):
        return settings.COUNTRIES_ISO_XML
    else:
        return '/usr/share/xml/iso-codes/iso_3166.xml'

FLAG_URL = _build_flag_url()
ISO_XML = _build_iso_xml()