Esempio n. 1
0
    def setUpClass(cls):
        dbapi = make_test_dbapi()
        filemanager = FileService('/tmp')
        transaction = FakeTransaction()
        invapi = DocumentApi(dbapi.session, filemanager, transaction, Invoice)
        pedidoapi = PedidoApi(sessionmanager=dbapi.session, filemanager=filemanager)
        identity = lambda x: x
        wsgi = make_nota_api(
            '/api',
            dbapi,
            actionlogged=identity,
            invapi=invapi,
            auth_decorator=identity,
            pedidoapi=pedidoapi,
            workerqueue=None)
        cls.test_app = TestApp(wsgi)
        cls.dbapi = dbapi
        #insert some pricelist items

        with dbapi.session:
#            p1 = PriceList()
#            p1.precio1 = 150
#            p1.nombre = 'HILO ALGODON FINO'
#            p1.prod_id = 'HALGF'
#            p1.precio2 = 125
#            p1.threshold = 6000
#            p1.almacen_id = 1
#            dbapi.create(p1)
#            p2 = PriceList()
#            p2.almacen_id = 1
#            p2.precio1 = 50
#            p2.nombre = 'TERMINAL DE PULSERA MD.'
#            p2.prod_id = 'TPM'
#            p2.precio2 = 40
#            p2.threshold = 6000
#            dbapi.create(p2)
            alm = Store()
            alm.almacen_id = 3
            dbapi.create(alm)
            dbapi.db_session.commit()
Esempio n. 2
0
    def setUpClass(cls):
        dbapi = make_test_dbapi()
        filemanager = FileService('/tmp')
        transaction = FakeTransaction()
        invapi = DocumentApi(dbapi.session, filemanager, transaction, Invoice)
        pedidoapi = PedidoApi(sessionmanager=dbapi.session, filemanager=filemanager)
        identity = lambda x: x
        wsgi = make_nota_api(
            '/api',
            dbapi,
            actionlogged=identity,
            invapi=invapi,
            auth_decorator=identity,
            pedidoapi=pedidoapi)
        cls.test_app = TestApp(wsgi)
        cls.dbapi = dbapi
        #insert some pricelist items

        with dbapi.session:
#            p1 = PriceList()
#            p1.precio1 = 150
#            p1.nombre = 'HILO ALGODON FINO'
#            p1.prod_id = 'HALGF'
#            p1.precio2 = 125
#            p1.threshold = 6000
#            p1.almacen_id = 1
#            dbapi.create(p1)
#            p2 = PriceList()
#            p2.almacen_id = 1
#            p2.precio1 = 50
#            p2.nombre = 'TERMINAL DE PULSERA MD.'
#            p2.prod_id = 'TPM'
#            p2.precio2 = 40
#            p2.threshold = 6000
#            dbapi.create(p2)
            alm = Store()
            alm.almacen_id = 3
            dbapi.create(alm)
            dbapi.db_session.commit()
Esempio n. 3
0
from beaker.middleware import SessionMiddleware

from henry.base.dbapi import DBApiGeneric
from henry.invoice.coreapi import make_nota_api
from henry.product.coreapi import make_search_pricelist_api
from henry.users.coreapi import make_client_coreapi
from henry.coreconfig import (BEAKER_SESSION_OPTS, invapi, auth_decorator, pedidoapi,
                              sessionmanager, actionlogged)

dbapi = DBApiGeneric(sessionmanager)
# GET pricelist
queryprod = make_search_pricelist_api('/api', auth_decorator, dbapi)
# POST/PUT invoice
invoice = make_nota_api('/api', dbapi, actionlogged, invapi, auth_decorator, pedidoapi)
# GET CLIENT + AUTH
clientapis = make_client_coreapi('/api', dbapi, actionlogged)
clientapis.merge(queryprod)
clientapis.merge(invoice)
api = clientapis
application = SessionMiddleware(api, BEAKER_SESSION_OPTS)
Esempio n. 4
0
    session = SessionManager(sessionfactory)
    # need a different session for processor, as it might run outside
    # of a http request context
    dbapi2 = DBApiGeneric(session)
    processor = ForwardRequestProcessor(dbapi2, REMOTE_URL, (REMOTE_USER, REMOTE_PASS), CODENAME)
    @spool
    def method(x):
        processor.forward_request(x)
    workerqueue = method.spool
    print 'started worker thread'


actionlogged = lambda x: x

# GET pricelist
queryprod = make_search_pricelist_api('/api', actionlogged=actionlogged, dbapi=dbapi)
# POST/PUT invoice
invoice = make_nota_api(
    '/api',
    dbapi=dbapi, actionlogged=actionlogged, invapi=invapi, auth_decorator=auth_decorator,
    pedidoapi=pedidoapi, workerqueue=workerqueue)
# GET CLIENT + AUTH
clientapis = make_client_coreapi('/api', dbapi, actionlogged)

all_apps = [clientapis, queryprod, invoice]
api = Bottle()
for a in all_apps:
    api.merge(a)
application = SessionMiddleware(api, BEAKER_SESSION_OPTS)