示例#1
0
def init_base():
    init_logging()
    mainlog.setLevel(logging.INFO)
    load_configuration("server.cfg")

    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
                                     description='This is an Horse! migration script.',
                                     epilog="For example --db-url {}".format(
                                         configuration.get("Database", "admin_url")))

    parser.add_argument('--db-url', default=configuration.database_url, help='Database URL')
    args = parser.parse_args()

    mainlog.info("Connecting to {}".format(args.db_url))
    init_i18n()
    from koi.db_mapping import metadata
    init_db_session(args.db_url, metadata, False)  # True or configuration.echo_query)
示例#2
0
from datetime import date
import argparse
from sqlalchemy.sql import select, func, and_, or_

from koi.base_logging import mainlog, init_logging
from koi.Configurator import init_i18n, load_configuration, configuration, resource_dir
init_logging()
init_i18n()
load_configuration()

from koi.db_mapping import metadata
from koi.datalayer.database_session import init_db_session, db_engine, session

from koi.datalayer.supplier_mapping import Supplier
from koi.datalayer.supply_order_mapping import SupplyOrderPart, SupplyOrder

import argparse

parser = argparse.ArgumentParser(
    description='This is an Horse! migration script.')
parser.add_argument('--db-url',
                    default=configuration.database_url,
                    help='Database connection URL {}'.format(
                        configuration.database_url))


def alter_structure():

    try:
        session().connection().execute("drop table horse.supplier_orders")
        session().commit()
示例#3
0
文件: demo.py 项目: wiz21b/koi
import decimal
import random
import logging
from datetime import date, datetime, timedelta

from koi.Configurator import init_i18n
import uuid
from sqlalchemy.sql.functions import func

init_i18n('en_EN') # The server speaks english

from koi.base_logging import mainlog,init_logging



from koi.datalayer.create_database import create_blank_database
from koi.datalayer.database_session import session
from koi.Configurator import configuration

from koi.dao import DAO

from koi.db_mapping import OperationDefinitionPeriod, OrderStatusType, Employee, OrderPartStateType, DeliverySlip, DeliverySlipPart
from koi.db_mapping import FilterQuery, TaskActionReport, TaskActionReportType, TaskOnOperation, TimeTrack, DayTimeSynthesis, Operation, ProductionFile, Order, OrderPart, Customer, OperationDefinition
from koi.datalayer.employee_mapping import RoleType

from koi.central_clock import central_clock

def daterange(start_date, end_date):
    for n in range(int ((end_date - start_date).days)):
        yield start_date + timedelta(n)
示例#4
0
文件: python.py 项目: wiz21b/koi
# parser.add_argument('--watchdog-file', action='store_true', default="watchdog", help='Watch dog file')
args = parser.parse_args()

if args.dev:
    args.debug = args.console = args.no_update = True

init_logging( console_log=args.console)

if args.debug:
    mainlog.setLevel(logging.DEBUG)

mainlog.info(copyright())
mainlog.info(license_short())

if args.screenshots:
    init_i18n("en_UK")
else:
    init_i18n()

load_configuration()

upgrade_process(args)


# Help cx_freeze
#noinspection PyUnresolvedReferences
import reportlab.graphics.barcode.common
#noinspection PyUnresolvedReferences
import reportlab.graphics.barcode.code128
#noinspection PyUnresolvedReferences
import reportlab.graphics.barcode.code93