This file is indexed.

/usr/share/pyshared/webhelpers/constants.py is in python-webhelpers 1.3-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# -*- encoding: latin-1 -*-
# Latin-1 encoding needed for countries list.
"""Place names and other constants often used in web forms.
"""

def uk_counties():
    """\
    Return a list of UK county names.
    """
    # Based on http://www.gbet.com/AtoZ_counties/
    # Updated 2007-10-24
    return [x.strip()[2:] for x in """\
    * Avon
    * Bedfordshire
    * Berkshire
    * Borders
    * Buckinghamshire
    * Cambridgeshire
    * Central
    * Cheshire
    * Cleveland
    * Clwyd
    * Cornwall
    * County Antrim
    * County Armagh
    * County Down
    * County Fermanagh
    * County Londonderry
    * County Tyrone
    * Cumbria
    * Derbyshire
    * Devon
    * Dorset
    * Dumfries and Galloway
    * Durham
    * Dyfed
    * East Sussex
    * Essex
    * Fife
    * Gloucestershire
    * Grampian
    * Greater Manchester
    * Gwent
    * Gwynedd County
    * Hampshire
    * Herefordshire
    * Hertfordshire
    * Highlands and Islands
    * Humberside
    * Isle of Wight
    * Kent
    * Lancashire
    * Leicestershire
    * Lincolnshire
    * Lothian
    * Merseyside
    * Mid Glamorgan
    * Norfolk
    * North Yorkshire
    * Northamptonshire
    * Northumberland
    * Nottinghamshire
    * Oxfordshire
    * Powys
    * Rutland
    * Shropshire
    * Somerset
    * South Glamorgan
    * South Yorkshire
    * Staffordshire
    * Strathclyde
    * Suffolk
    * Surrey
    * Tayside
    * Tyne and Wear
    * Warwickshire
    * West Glamorgan
    * West Midlands
    * West Sussex
    * West Yorkshire
    * Wiltshire
    * Worcestershire""".split('\n')]

_country_codes = None
def country_codes():
    """Return a list of all country names as tuples. The tuple value is the
    country's 2-letter ISO code and its name; e.g., 
    ``("GB", "United Kingdom")``. The countries are in name order.
    
    Can be used like this::

        import webhelpers.constants as constants
        from webhelpers.html.tags import select
        select("country", country_codes(),
            prompt="Please choose a country ...")

    See here for more information:
    http://www.iso.org/iso/english_country_names_and_code_elements
    """
    # Updated on 2007-10-24.
    #
    # This might seem a funny implementation but it makes it easier to update
    # next time there is a change

    global _country_codes
    if _country_codes is not None:
        return _country_codes
    else:
        
        text_directly_from_iso_website = u"""
A   	  
AFGHANISTAN 	AF
ÅLAND ISLANDS 	AX
ALBANIA 	AL
ALGERIA 	DZ
AMERICAN SAMOA 	AS
ANDORRA 	AD
ANGOLA 	AO
ANGUILLA 	AI
ANTARCTICA 	AQ
ANTIGUA AND BARBUDA 	AG
ARGENTINA 	AR
ARMENIA 	AM
ARUBA 	AW
AUSTRALIA 	AU
AUSTRIA 	AT
AZERBAIJAN 	AZ
B 	 
BAHAMAS 	BS
BAHRAIN 	BH
BANGLADESH 	BD
BARBADOS 	BB
BELARUS 	BY
BELGIUM 	BE
BELIZE 	BZ
BENIN 	BJ
BERMUDA 	BM
BHUTAN 	BT
BOLIVIA 	BO
BOSNIA AND HERZEGOVINA 	BA
BOTSWANA 	BW
BOUVET ISLAND 	BV
BRAZIL 	BR
BRITISH INDIAN OCEAN TERRITORY 	IO
BRUNEI DARUSSALAM 	BN
BULGARIA 	BG
BURKINA FASO 	BF
BURUNDI 	BI
C 	 
CAMBODIA 	KH
CAMEROON 	CM
CANADA 	CA
CAPE VERDE 	CV
CAYMAN ISLANDS 	KY
CENTRAL AFRICAN REPUBLIC 	CF
CHAD 	TD
CHILE 	CL
CHINA 	CN
CHRISTMAS ISLAND 	CX
COCOS (KEELING) ISLANDS 	CC
COLOMBIA 	CO
COMOROS 	KM
CONGO 	CG
CONGO, THE DEMOCRATIC REPUBLIC OF THE 	CD
COOK ISLANDS 	CK
COSTA RICA 	CR
CÔTE D'IVOIRE 	CI
CROATIA 	HR
CUBA 	CU
CYPRUS 	CY
CZECH REPUBLIC 	CZ
D 	 
DENMARK 	DK
DJIBOUTI 	DJ
DOMINICA 	DM
DOMINICAN REPUBLIC 	DO
E 	 
ECUADOR 	EC
EGYPT 	EG
EL SALVADOR 	SV
EQUATORIAL GUINEA 	GQ
ERITREA 	ER
ESTONIA 	EE
ETHIOPIA 	ET
F 	 
FALKLAND ISLANDS (MALVINAS) 	FK
FAROE ISLANDS 	FO
FIJI 	FJ
FINLAND 	FI
FRANCE 	FR
FRENCH GUIANA 	GF
FRENCH POLYNESIA 	PF
FRENCH SOUTHERN TERRITORIES 	TF
G 	 
GABON 	GA
GAMBIA 	GM
GEORGIA 	GE
GERMANY 	DE
GHANA 	GH
GIBRALTAR 	GI
GREECE 	GR
GREENLAND 	GL
GRENADA 	GD
GUADELOUPE 	GP
GUAM 	GU
GUATEMALA 	GT
GUERNSEY 	GG
GUINEA 	GN
GUINEA-BISSAU 	GW
GUYANA 	GY
H 	 
HAITI 	HT
HEARD ISLAND AND MCDONALD ISLANDS 	HM
HOLY SEE (VATICAN CITY STATE) 	VA
HONDURAS 	HN
HONG KONG 	HK
HUNGARY 	HU
I 	 
ICELAND 	IS
INDIA 	IN
INDONESIA 	ID
IRAN, ISLAMIC REPUBLIC OF 	IR
IRAQ 	IQ
IRELAND 	IE
ISLE OF MAN 	IM
ISRAEL 	IL
ITALY 	IT
J 	 
JAMAICA 	JM
JAPAN 	JP
JERSEY 	JE
JORDAN 	JO
K 	 
KAZAKHSTAN 	KZ
KENYA 	KE
KIRIBATI 	KI
KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF 	KP
KOREA, REPUBLIC OF 	KR
KUWAIT 	KW
KYRGYZSTAN 	KG
L 	 
LAO PEOPLE'S DEMOCRATIC REPUBLIC 	LA
LATVIA 	LV
LEBANON 	LB
LESOTHO 	LS
LIBERIA 	LR
LIBYAN ARAB JAMAHIRIYA 	LY
LIECHTENSTEIN 	LI
LITHUANIA 	LT
LUXEMBOURG 	LU
M 	 
MACAO 	MO
MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF 	MK
MADAGASCAR 	MG
MALAWI 	MW
MALAYSIA 	MY
MALDIVES 	MV
MALI 	ML
MALTA 	MT
MARSHALL ISLANDS 	MH
MARTINIQUE 	MQ
MAURITANIA 	MR
MAURITIUS 	MU
MAYOTTE 	YT
MEXICO 	MX
MICRONESIA, FEDERATED STATES OF 	FM
MOLDOVA, REPUBLIC OF 	MD
MONACO 	MC
MONGOLIA 	MN
MONTENEGRO 	ME
MONTSERRAT 	MS
MOROCCO 	MA
MOZAMBIQUE 	MZ
MYANMAR 	MM
N 	 
NAMIBIA 	NA
NAURU 	NR
NEPAL 	NP
NETHERLANDS 	NL
NETHERLANDS ANTILLES 	AN
NEW CALEDONIA 	NC
NEW ZEALAND 	NZ
NICARAGUA 	NI
NIGER 	NE
NIGERIA 	NG
NIUE 	NU
NORFOLK ISLAND 	NF
NORTHERN MARIANA ISLANDS 	MP
NORWAY 	NO
O 	 
OMAN 	OM
P 	 
PAKISTAN 	PK
PALAU 	PW
PALESTINIAN TERRITORY, OCCUPIED 	PS
PANAMA 	PA
PAPUA NEW GUINEA 	PG
PARAGUAY 	PY
PERU 	PE
PHILIPPINES 	PH
PITCAIRN 	PN
POLAND 	PL
PORTUGAL 	PT
PUERTO RICO 	PR
Q 	 
QATAR 	QA
R 	
RÉUNION 	RE
ROMANIA 	RO
RUSSIAN FEDERATION 	RU
RWANDA 	RW
S 	 
SAINT BARTHÉLEMY 	BL
SAINT HELENA 	SH
SAINT KITTS AND NEVIS 	KN
SAINT LUCIA 	LC
SAINT MARTIN 	MF
SAINT PIERRE AND MIQUELON 	PM
SAINT VINCENT AND THE GRENADINES 	VC
SAMOA 	WS
SAN MARINO 	SM
SAO TOME AND PRINCIPE 	ST
SAUDI ARABIA 	SA
SENEGAL 	SN
SERBIA 	RS
SEYCHELLES 	SC
SIERRA LEONE 	SL
SINGAPORE 	SG
SLOVAKIA 	SK
SLOVENIA 	SI
SOLOMON ISLANDS 	SB
SOMALIA 	SO
SOUTH AFRICA 	ZA
SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS 	GS
SPAIN 	ES
SRI LANKA 	LK
SUDAN 	SD
SURINAME 	SR
SVALBARD AND JAN MAYEN 	SJ
SWAZILAND 	SZ
SWEDEN 	SE
SWITZERLAND 	CH
SYRIAN ARAB REPUBLIC 	SY
T 	 
TAIWAN, PROVINCE OF CHINA 	TW
TAJIKISTAN 	TJ
TANZANIA, UNITED REPUBLIC OF 	TZ
THAILAND 	TH
TIMOR-LESTE 	TL
TOGO 	TG
TOKELAU 	TK
TONGA 	TO
TRINIDAD AND TOBAGO 	TT
TUNISIA 	TN
TURKEY 	TR
TURKMENISTAN 	TM
TURKS AND CAICOS ISLANDS 	TC
TUVALU 	TV
U 	 
UGANDA 	UG
UKRAINE 	UA
UNITED ARAB EMIRATES 	AE
UNITED KINGDOM 	GB
UNITED STATES 	US
UNITED STATES MINOR OUTLYING ISLANDS 	UM
URUGUAY 	UY
UZBEKISTAN 	UZ
V 	 
VANUATU 	VU
VATICAN CITY STATE 	see HOLY SEE
VENEZUELA 	VE
VIET NAM 	VN
VIRGIN ISLANDS, BRITISH 	VG
VIRGIN ISLANDS, U.S. 	VI
W 	 
WALLIS AND FUTUNA 	WF
WESTERN SAHARA 	EH
Y 	 
YEMEN 	YE
Z 	 
ZAIRE 	see CONGO, THE DEMOCRATIC REPUBLIC OF THE
ZAMBIA 	ZM
ZIMBABWE 	ZW
""".replace('\t','    ').split('\n')
    e = []
    for item in text_directly_from_iso_website:
        if len(item) > 1:
            p=[]
            parts = item.split('  ')
            for part in parts:
                if part.strip():
                    p.append(part.strip())
            if len(p)>2:
                raise Exception("Invalid entry %s" % p)

            p.reverse()
            if len(p) == 1:
                # It is just a letter
                continue
            if len(p[0]) != 2:
                if p[0][:3] != 'see':
                    raise Exception('Unknown entry %s'%(p))
                else:
                    # We just want to ignore it
                    continue
            p = tuple(p)
            e.append(p)
    _country_codes = e
    return _country_codes

def us_states():
    """List of USA states.

    Return a list of ``(abbreviation, name)`` for all US states, sorted by name.
    Includes the District of Columbia.
    """
    # From http://www.usps.com/ncsc/lookups/abbreviations.html
    #Updated 2008-05-01
    return [
        ("AL", "Alabama"),
        ("AK", "Alaska"),
        ("AZ", "Arizona"),
        ("AR", "Arkansas"),
        ("CA", "California"),
        ("CO", "Colorado"),
        ("CT", "Connecticut"),
        ("DE", "Delaware"),
        ("DC", "District of Columbia"),
        ("FL", "Florida"),
        ("GA", "Georgia"),
        ("HI", "Hawaii"),
        ("ID", "Idaho"),
        ("IL", "Illinois"),
        ("IN", "Indiana"),
        ("IA", "Iowa"),
        ("KS", "Kansas"),
        ("KY", "Kentucky"),
        ("LA", "Louisiana"),
        ("ME", "Maine"),
        ("MD", "Maryland"),
        ("MA", "Massachusetts"),
        ("MI", "Michigan"),
        ("MN", "Minnesota"),
        ("MS", "Mississippi"),
        ("MO", "Missouri"),
        ("MT", "Montana"),
        ("NE", "Nebraska"),
        ("NV", "Nevada"),
        ("NH", "New Hampshire"),
        ("NJ", "New Jersey"),
        ("NM", "New Mexico"),
        ("NY", "New York"),
        ("NC", "North Carolina"),
        ("ND", "North Dakota"),
        ("OH", "Ohio"),
        ("OK", "Oklahoma"),
        ("OR", "Oregon"),
        ("PA", "Pennsylvania"),
        ("RI", "Rhode Island"),
        ("SC", "South Carolina"),
        ("SD", "South Dakota"),
        ("TN", "Tennessee"),
        ("TX", "Texas"),
        ("UT", "Utah"),
        ("VT", "Vermont"),
        ("VA", "Virginia"),
        ("WA", "Washington"),
        ("WV", "West Virginia"),
        ("WI", "Wisconsin"),
        ("WY", "Wyoming"),
        ]

def us_territories():
    """USA postal abbreviations for territories, protectorates, and military.
    
    The return value is a list of ``(abbreviation, name)`` tuples. The
    locations are sorted by name.
    """
    # From http://www.usps.com/ncsc/lookups/abbreviations.html
    # Updated 2008-05-01
    return [
        ("AS", "American Samoa"),
        ("AA", "Armed Forces Americas"),
        ("AE", "Armed Forces Europe/Canada/Middle East/Africa"),
        ("AP", "Armed Forces Pacific"),
        ("FM", "Federated States of Micronesia"),
        ("GU", "Guam"),
        ("MH", "Marshall Islands"),
        ("MP", "Northern Mariana Islands"),
        ("PW", "Palau"),
        ("PR", "Puerto Rico"),
        ("VI", "Virgin Islands"),
        ]
    

def canada_provinces():
    """List of Canadian provinces.

    Return a list of ``(abbreviation, name)`` tuples for all Canadian
    provinces and territories, sorted by name.
    """
    # Based on:
    # http://en.wikipedia.org/wiki/Canadian_subnational_postal_abbreviations
    # See also: 
    # http://en.wikipedia.org/wiki/Provinces_and_territories_of_Canada
    # Updated 2008-05-01
    provinces = [
        ("Alberta", "AB"),
        ("British Columbia", "BC"),
        ("Manitoba", "MB"),
        ("New Brunswick", "NB"),
        ("Newfoundland and Labrador", "NL"),
        ("Nova Scotia", "NS"),
        ("Northwest Territories", "NT"),
        ("Nunavut", "NU"),
        ("Ontario", "ON"),
        ("Prince Edward Island", "PE"),
        ("Quebec", "QC"),
        ("Saskatchewan", "SK"),
        ("Yukon", "YT"),
        ]
    provinces.sort()
    return [(x[1], x[0]) for x in provinces]