This commit is contained in:
jar3b 2016-03-12 20:14:28 +03:00
parent 19d80f5811
commit ad70ef7742
5 changed files with 28 additions and 12 deletions

View File

@ -20,5 +20,5 @@ class BottleCL(object):
else: else:
self._app.error_handler[error_code] = handler self._app.error_handler[error_code] = handler
def start(self, host, port): def start(self, **kwargs):
self._app.run(host=host, port=port) self._app.run(**kwargs)

View File

@ -9,9 +9,9 @@ from miscutils.bottlecl import BottleCL
class App(BottleCL): class App(BottleCL):
def __init__(self): def __init__(self, log_filename):
super(App, self).__init__() super(App, self).__init__()
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO) logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO, filename=log_filename)
self._factory = FiasFactory() self._factory = FiasFactory()

View File

@ -55,11 +55,27 @@ class Updater:
finally: finally:
db.close() db.close()
# Получает верию ФИАС с клавиатуры (если мы берем базу из папки или локального архива и не можем определить,
# что это за версия
@staticmethod
def __get_update_version_from_console():
mode = None
while not mode:
try:
mode = int(raw_input('Enter FIAS update version (3 digit):'))
except ValueError:
print "Not a valid fias version, try again."
return mode
def __get_updates_from_folder(self, foldername): def __get_updates_from_folder(self, foldername):
# TODO: Вычислять версию, если берем данные из каталога # TODO: Вычислять версию, если берем данные из каталога
yield dict(intver=0, textver="Unknown", delta_url=foldername, complete_url=foldername) yield dict(intver=self.__get_update_version_from_console(),
textver="Unknown", delta_url=foldername,
complete_url=foldername)
def __get_updates_from_rar(self, url): @staticmethod
def __get_updates_from_rar(url):
aorar = AoRar() aorar = AoRar()
if url.startswith("http://") or url.startswith("https://"): if url.startswith("http://") or url.startswith("https://"):

View File

@ -2,16 +2,16 @@
from aore import config from aore import config
# Config section # Config section
config.sphinx_conf.listen = "192.168.0.37:9312" config.sphinx_conf.listen = "127.0.0.1:9312"
config.sphinx_conf.var_dir = "C:\\Sphinx" config.sphinx_conf.var_dir = "C:\\Sphinx"
config.db_conf.database = "pyfias" config.db_conf.database = "pyfias"
config.db_conf.host = "192.168.0.37" config.db_conf.host = "192.168.0.1"
config.db_conf.port = 5432 config.db_conf.port = 5432
config.db_conf.user = "postgres" config.db_conf.user = "postgres"
config.db_conf.password = "intercon" config.db_conf.password = "postgres"
config.unrar_config.path = "C:\\Program Files (x86)\\WinRAR\\unrar.exe" config.unrar_config.path = "C:\\Program Files\\WinRAR\\unrar.exe"
config.folders.temp = "E:\\!TEMP" config.folders.temp = "E:\\!TEMP"
config.basic.logging = True config.basic.logging = True

View File

@ -9,8 +9,8 @@ except ImportError:
assert "No config" assert "No config"
# Define main app # Define main app
application = phias.App() application = phias.App("pyphias.log")
# Run bottle WSGI server if no external # Run bottle WSGI server if no external
if __name__ == '__main__': if __name__ == '__main__':
application.start('0.0.0.0', 8087) application.start(host='0.0.0.0', port=8087, debug=True)