mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Delete g.countries.
This commit is contained in:
14
r2/Makefile
14
r2/Makefile
@@ -247,17 +247,3 @@ clean_gzip:
|
||||
rm -f $(GZIPPED)
|
||||
|
||||
$(shell rm -f $(DEFS_FILE))
|
||||
|
||||
#################### country list
|
||||
COUNTRY_FILE := $(STATIC_BUILD_DIR)/countries.json
|
||||
|
||||
countries: $(COUNTRY_FILE)
|
||||
|
||||
$(STATIC_BUILD_DIR):
|
||||
mkdir -p $(STATIC_BUILD_DIR)
|
||||
|
||||
$(COUNTRY_FILE): $(STATIC_BUILD_DIR)
|
||||
$(PYTHON) r2/lib/countries.py > $(COUNTRY_FILE)
|
||||
|
||||
clean_countries:
|
||||
rm -f $(COUNTRY_FILE)
|
||||
|
||||
@@ -563,17 +563,12 @@ compress_level = 6
|
||||
min_size = 800
|
||||
|
||||
[loggers]
|
||||
keys = root, pycountry
|
||||
keys = root
|
||||
|
||||
[logger_root]
|
||||
level = WARNING
|
||||
handlers = console
|
||||
|
||||
[logger_pycountry]
|
||||
level = CRITICAL
|
||||
qualname = pycountry.db
|
||||
handlers =
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ from r2.lib.cache import (
|
||||
)
|
||||
from r2.lib.configparse import ConfigValue, ConfigValueParser
|
||||
from r2.lib.contrib import ipaddress
|
||||
from r2.lib.countries import get_countries_and_codes
|
||||
from r2.lib.lock import make_lock_factory
|
||||
from r2.lib.manager import db_manager
|
||||
from r2.lib.plugin import PluginLoader
|
||||
@@ -377,16 +376,6 @@ class Globals(object):
|
||||
csslog = logging.getLogger("cssutils")
|
||||
cssutils.log.setLog(csslog)
|
||||
|
||||
# load the country list
|
||||
countries_file_path = os.path.join(static_files, "countries.json")
|
||||
try:
|
||||
with open(countries_file_path) as handle:
|
||||
self.countries = json.load(handle)
|
||||
self.log.debug("Using countries.json.")
|
||||
except IOError:
|
||||
self.log.warning("Couldn't find countries.json. Using pycountry.")
|
||||
self.countries = get_countries_and_codes()
|
||||
|
||||
if not self.media_domain:
|
||||
self.media_domain = self.domain
|
||||
if self.media_domain == self.domain:
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# The contents of this file are subject to the Common Public Attribution
|
||||
# License Version 1.0. (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
|
||||
# License Version 1.1, but Sections 14 and 15 have been added to cover use of
|
||||
# software over a computer network and provide for limited attribution for the
|
||||
# Original Developer. In addition, Exhibit A has been modified to be consistent
|
||||
# with Exhibit B.
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
# the specific language governing rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is reddit.
|
||||
#
|
||||
# The Original Developer is the Initial Developer. The Initial Developer of
|
||||
# the Original Code is reddit Inc.
|
||||
#
|
||||
# All portions of the code written by reddit are Copyright (c) 2006-2013 reddit
|
||||
# Inc. All Rights Reserved.
|
||||
###############################################################################
|
||||
|
||||
import json
|
||||
|
||||
|
||||
def get_countries_and_codes():
|
||||
"""Return a dict of ISO Alpha2 country codes to country names."""
|
||||
|
||||
# avoid importing this until this function is called since we're going to
|
||||
# try our best to not import this at all in the app. it takes a tonne of
|
||||
# memory!
|
||||
import pycountry
|
||||
|
||||
return {x.alpha2: x.name for x in pycountry.countries}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Print out the country dict in JSON format for use in the Makefile.
|
||||
print json.dumps(get_countries_and_codes(), indent=2, sort_keys=True)
|
||||
@@ -83,7 +83,6 @@ setup(
|
||||
"cssutils==0.9.5.1",
|
||||
"chardet",
|
||||
"psycopg2",
|
||||
"pycountry",
|
||||
"pycassa>=1.7.0",
|
||||
"PIL",
|
||||
"pycaptcha",
|
||||
|
||||
Reference in New Issue
Block a user