Переделан конфиг (под dev и production)

This commit is contained in:
Jack Stdin
2016-01-31 23:23:52 +03:00
parent c65f78dd06
commit 1a221d9a93
16 changed files with 117 additions and 106 deletions

View File

@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import os
from aore.updater.aoxmltableentry import AoXmlTableEntry
from aore.config import trashfolder
from aore.config import folders
from aore.dbutils.dbschemas import db_shemas
from xmlparser import XMLParser
@@ -52,7 +51,7 @@ class AoDataParser:
self.data_bereit_callback = data_callback
self.currentpage = 0
self.base_filename = \
trashfolder + "fd_" + \
folders.temp + "/fd_" + \
str(self.datasource.operation_type) + "_" + \
self.datasource.table_name + ".csv.part{}"
self.counter = self.pagesize + 1

View File

@@ -7,21 +7,22 @@ from traceback import format_exc
import rarfile
import requests
from aore.config import unrar, trashfolder
from aore.config import folders, unrar_config
from aoxmltableentry import AoXmlTableEntry
class AoRar:
def __init__(self):
rarfile.UNRAR_TOOL = unrar
rarfile.UNRAR_TOOL = unrar_config.path
def download(self, url):
logging.info("Downloading {}".format(url))
try:
local_filename = os.path.abspath(trashfolder + url.split('/')[-1])
local_filename = os.path.abspath(folders.temp + "/" + url.split('/')[-1])
if os.path.isfile(local_filename):
# TODO: UNCOMMENT os.remove(local_filename)
return local_filename
os.remove(local_filename)
request = requests.get(url, stream=True)
with open(local_filename, 'wb') as f:

View File

@@ -5,15 +5,15 @@ import logging
import psycopg2
from bottle import template
from aore.updater.aoxmltableentry import AoXmlTableEntry
from aore.config import db as dbparams
from aore.config import db_conf
from aore.dbutils.dbimpl import DBImpl
from aore.dbutils.dbschemas import db_shemas
from aore.updater.aoxmltableentry import AoXmlTableEntry
class DbHandler:
def __init__(self):
self.db = DBImpl(psycopg2, dbparams)
self.db = DBImpl(psycopg2, db_conf)
def bulk_csv(self, operation_type, table_name, processed_count, csv_file_name):
sql_query = None

View File

@@ -3,12 +3,11 @@
import logging
from os import walk, path
from aore.dbutils.dbschemas import allowed_tables
from aore.updater.aodataparser import AoDataParser
from aore.updater.aorar import AoRar
from aore.updater.aoxmltableentry import AoXmlTableEntry
from aore.updater.dbhandler import DbHandler
from aore.updater.soapreceiver import SoapReceiver
from aore.dbutils.dbschemas import allowed_tables
class Updater: