diff --git a/LBBulk.egg-info/PKG-INFO b/LBBulk.egg-info/PKG-INFO new file mode 100644 index 0000000..1abb858 --- /dev/null +++ b/LBBulk.egg-info/PKG-INFO @@ -0,0 +1,35 @@ +Metadata-Version: 1.1 +Name: LBBulk +Version: 0.1 +Summary: Translator for external keys to fit properly on the lightbase standard +Home-page: UNKNOWN +Author: Lightbase +Author-email: pedro.ricardo@lightbase.com +License: UNKNOWN +Description: LBBulk README + ================== + + Getting Started + --------------- + + - cd + + - $VENV/bin/python setup.py develop + + - $VENV/bin/initialize_LBBulk_db development.ini + + - $VENV/bin/pserve development.ini + + + + 0.0 + --- + + - Initial version + +Keywords: lightbase database translator bulk pyramid +Platform: UNKNOWN +Classifier: Development Status :: 2 - Pre-AlphaFramework :: Pyramid +Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) +Classifier: Natural Language :: EnglishProgramming Language :: Python :: 3 +Classifier: Topic :: Database :: Database Engines/Servers diff --git a/LBBulk.egg-info/SOURCES.txt b/LBBulk.egg-info/SOURCES.txt new file mode 100644 index 0000000..8659096 --- /dev/null +++ b/LBBulk.egg-info/SOURCES.txt @@ -0,0 +1,33 @@ +CHANGES.txt +MANIFEST.in +README.txt +TODO.txt +development.ini +production.ini +setup.cfg +setup.py +LBBulk.egg-info/PKG-INFO +LBBulk.egg-info/SOURCES.txt +LBBulk.egg-info/dependency_links.txt +LBBulk.egg-info/entry_points.txt +LBBulk.egg-info/not-zip-safe +LBBulk.egg-info/requires.txt +LBBulk.egg-info/top_level.txt +lbbulk/__init__.py +lbbulk/config/__init__.py +lbbulk/config/routing.py +lbbulk/model/Registro.py +lbbulk/model/__init__.py +lbbulk/scripts/__init__.py +lbbulk/scripts/initializedb.py +lbbulk/static/favicon.ico +lbbulk/static/footerbg.png +lbbulk/static/headerbg.png +lbbulk/static/ie6.css +lbbulk/static/middlebg.png +lbbulk/static/pylons.css +lbbulk/static/pyramid-small.png +lbbulk/static/pyramid.png +lbbulk/static/transparent.gif +lbbulk/templates/mytemplate.pt +lbbulk/view/__init__.py \ No newline at end of file diff --git a/LBBulk.egg-info/dependency_links.txt b/LBBulk.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/LBBulk.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/LBBulk.egg-info/entry_points.txt b/LBBulk.egg-info/entry_points.txt new file mode 100644 index 0000000..b7ec4cd --- /dev/null +++ b/LBBulk.egg-info/entry_points.txt @@ -0,0 +1,5 @@ + [paste.app_factory] + main = lbbulk:main + [console_scripts] + initialize_LBBulk_db = lbbulk.scripts.initializedb:main + \ No newline at end of file diff --git a/LBBulk.egg-info/not-zip-safe b/LBBulk.egg-info/not-zip-safe new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/LBBulk.egg-info/not-zip-safe @@ -0,0 +1 @@ + diff --git a/LBBulk.egg-info/requires.txt b/LBBulk.egg-info/requires.txt new file mode 100644 index 0000000..caecafc --- /dev/null +++ b/LBBulk.egg-info/requires.txt @@ -0,0 +1,9 @@ +pyramid +pyramid_chameleon +pyramid_debugtoolbar +pyramid_tm +SQLAlchemy +transaction +zope.sqlalchemy +waitress +pyramid_restler \ No newline at end of file diff --git a/LBBulk.egg-info/top_level.txt b/LBBulk.egg-info/top_level.txt new file mode 100644 index 0000000..fb48188 --- /dev/null +++ b/LBBulk.egg-info/top_level.txt @@ -0,0 +1 @@ +lbbulk diff --git a/TODO.txt b/TODO.txt index 43d2a31..7517906 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1 +1,5 @@ -- coisas \ No newline at end of file +- Recebe registro +- Verifica se o registro já existe no lightbase: + se sim, atualiza + se não, cria +- salva na tabela de chaves a chave do lightbase que corresponde à esse registro \ No newline at end of file diff --git a/build/lib/lbbulk/__init__.py b/build/lib/lbbulk/__init__.py new file mode 100644 index 0000000..44b48bc --- /dev/null +++ b/build/lib/lbbulk/__init__.py @@ -0,0 +1,19 @@ +from pyramid.config import Configurator +from sqlalchemy import engine_from_config +from lbbulk.config.routing import make_routes + +from lbbulk.model import Base, metadata, DBSession + + +def main(global_config, **settings): + """ This function returns a Pyramid WSGI application. + """ + config = Configurator(settings=settings) + config.scan('lbbulk') + engine = engine_from_config(settings, 'sqlalchemy.') + DBSession.configure(bind=engine) + Base.metadata.bind = engine + config.include('pyramid_chameleon') + make_routes(config) + config.enable_POST_tunneling() + return config.make_wsgi_app() \ No newline at end of file diff --git a/build/lib/lbbulk/config/__init__.py b/build/lib/lbbulk/config/__init__.py new file mode 100644 index 0000000..d310fdd --- /dev/null +++ b/build/lib/lbbulk/config/__init__.py @@ -0,0 +1 @@ +# package \ No newline at end of file diff --git a/build/lib/lbbulk/config/routing.py b/build/lib/lbbulk/config/routing.py new file mode 100644 index 0000000..c7088cf --- /dev/null +++ b/build/lib/lbbulk/config/routing.py @@ -0,0 +1,9 @@ +from lbbulk.model.Registo import RegistroContextFactory + +def make_routes(config): + """ + Create routes + """ + config.add_static_view('static', 'static', cache_max_age=3600) + config.add_route('home', '/') + config.add_restful_routes('registo', Registo.RegistroContextFactory) \ No newline at end of file diff --git a/build/lib/lbbulk/model/Registro.py b/build/lib/lbbulk/model/Registro.py new file mode 100644 index 0000000..126e3c9 --- /dev/null +++ b/build/lib/lbbulk/model/Registro.py @@ -0,0 +1,38 @@ +from sqlalchemy import Table, Column, Integer, \ + String, join, ForeignKey +from sqlalchemy.orm import column_property +from pyramid_restler.model import SQLAlchemyORMContext +from lbbulk.model import Base, metadata + +# define two Table objects +bulk_sources = Table('lb_bulk_sources', metadata, + Column('id_source', Integer, primary_key=True), + Column('nome_source', String), + ) + +bulk_upload = Table('lb_bulk_upload', metadata, + Column('id_reg', Integer, primary_key=True), + Column('chave_externa', String), + Column('id_source', Integer, ForeignKey('lb_bulk_sources.id_source')) + ) + +# define a join between them. This +# takes place across the bulk_sources.id_source and bulk_upload.id_source +# columns. +registro = join(bulk_sources, bulk_upload) + +# map to it +class Registro(Base): + __table__ = registro + id_source = column_property(bulk_sources.c.id_source, bulk_upload.c.id_source) + +class RegistroContextFactory(SQLAlchemyORMContext): + + entity = Registro + + def session_factory(self): + return Session() + +def root_view(context, request): + registro = Session().query(Registro).all() + return dict(registro=registro, Registro=Registro) \ No newline at end of file diff --git a/build/lib/lbbulk/model/__init__.py b/build/lib/lbbulk/model/__init__.py new file mode 100644 index 0000000..49efc4f --- /dev/null +++ b/build/lib/lbbulk/model/__init__.py @@ -0,0 +1,7 @@ +from sqlalchemy import MetaData +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import scoped_session, sessionmaker + +metadata = MetaData() +Base = declarative_base() +DBSession = scoped_session(sessionmaker()) \ No newline at end of file diff --git a/build/lib/lbbulk/scripts/__init__.py b/build/lib/lbbulk/scripts/__init__.py new file mode 100644 index 0000000..5bb534f --- /dev/null +++ b/build/lib/lbbulk/scripts/__init__.py @@ -0,0 +1 @@ +# package diff --git a/build/lib/lbbulk/scripts/initializedb.py b/build/lib/lbbulk/scripts/initializedb.py new file mode 100644 index 0000000..30885e3 --- /dev/null +++ b/build/lib/lbbulk/scripts/initializedb.py @@ -0,0 +1,40 @@ +# import os +# import sys +# import transaction + +# from sqlalchemy import engine_from_config + +# from pyramid.paster import ( +# get_appsettings, +# setup_logging, +# ) + +# from pyramid.scripts.common import parse_vars + +# from ..models import ( +# DBSession, +# MyModel, +# Base, +# ) + + +# def usage(argv): +# cmd = os.path.basename(argv[0]) +# print('usage: %s [var=value]\n' +# '(example: "%s development.ini")' % (cmd, cmd)) +# sys.exit(1) + + +# def main(argv=sys.argv): +# if len(argv) < 2: +# usage(argv) +# config_uri = argv[1] +# options = parse_vars(argv[2:]) +# setup_logging(config_uri) +# settings = get_appsettings(config_uri, options=options) +# engine = engine_from_config(settings, 'sqlalchemy.') +# DBSession.configure(bind=engine) +# Base.metadata.create_all(engine) +# with transaction.manager: +# model = MyModel(name='one', value=1) +# DBSession.add(model) diff --git a/build/lib/lbbulk/static/favicon.ico b/build/lib/lbbulk/static/favicon.ico new file mode 100644 index 0000000..71f837c Binary files /dev/null and b/build/lib/lbbulk/static/favicon.ico differ diff --git a/build/lib/lbbulk/static/footerbg.png b/build/lib/lbbulk/static/footerbg.png new file mode 100644 index 0000000..1fbc873 Binary files /dev/null and b/build/lib/lbbulk/static/footerbg.png differ diff --git a/build/lib/lbbulk/static/headerbg.png b/build/lib/lbbulk/static/headerbg.png new file mode 100644 index 0000000..0596f20 Binary files /dev/null and b/build/lib/lbbulk/static/headerbg.png differ diff --git a/build/lib/lbbulk/static/ie6.css b/build/lib/lbbulk/static/ie6.css new file mode 100644 index 0000000..b7c8493 --- /dev/null +++ b/build/lib/lbbulk/static/ie6.css @@ -0,0 +1,8 @@ +* html img, +* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none", +this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')", +this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''), +this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')", +this.runtimeStyle.backgroundImage = "none")),this.pngSet=true) +);} +#wrap{display:table;height:100%} diff --git a/build/lib/lbbulk/static/middlebg.png b/build/lib/lbbulk/static/middlebg.png new file mode 100644 index 0000000..2369cfb Binary files /dev/null and b/build/lib/lbbulk/static/middlebg.png differ diff --git a/build/lib/lbbulk/static/pylons.css b/build/lib/lbbulk/static/pylons.css new file mode 100644 index 0000000..4b1c017 --- /dev/null +++ b/build/lib/lbbulk/static/pylons.css @@ -0,0 +1,372 @@ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td +{ + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; /* 16px */ + vertical-align: baseline; + background: transparent; +} + +body +{ + line-height: 1; +} + +ol, ul +{ + list-style: none; +} + +blockquote, q +{ + quotes: none; +} + +blockquote:before, blockquote:after, q:before, q:after +{ + content: ''; + content: none; +} + +:focus +{ + outline: 0; +} + +ins +{ + text-decoration: none; +} + +del +{ + text-decoration: line-through; +} + +table +{ + border-collapse: collapse; + border-spacing: 0; +} + +sub +{ + vertical-align: sub; + font-size: smaller; + line-height: normal; +} + +sup +{ + vertical-align: super; + font-size: smaller; + line-height: normal; +} + +ul, menu, dir +{ + display: block; + list-style-type: disc; + margin: 1em 0; + padding-left: 40px; +} + +ol +{ + display: block; + list-style-type: decimal-leading-zero; + margin: 1em 0; + padding-left: 40px; +} + +li +{ + display: list-item; +} + +ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl +{ + margin-top: 0; + margin-bottom: 0; +} + +ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir +{ + list-style-type: circle; +} + +ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir +{ + list-style-type: square; +} + +.hidden +{ + display: none; +} + +p +{ + line-height: 1.5em; +} + +h1 +{ + font-size: 1.75em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +h2 +{ + font-size: 1.5em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +h3 +{ + font-size: 1.25em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +h4 +{ + font-size: 1em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +html, body +{ + width: 100%; + height: 100%; +} + +body +{ + margin: 0; + padding: 0; + background-color: #fff; + position: relative; + font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif; +} + +a +{ + color: #1b61d6; + text-decoration: none; +} + +a:hover +{ + color: #e88f00; + text-decoration: underline; +} + +body h1, body h2, body h3, body h4, body h5, body h6 +{ + font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif; + font-weight: 400; + color: #373839; + font-style: normal; +} + +#wrap +{ + min-height: 100%; +} + +#header, #footer +{ + width: 100%; + color: #fff; + height: 40px; + position: absolute; + text-align: center; + line-height: 40px; + overflow: hidden; + font-size: 12px; + vertical-align: middle; +} + +#header +{ + background: #000; + top: 0; + font-size: 14px; +} + +#footer +{ + bottom: 0; + background: #000 url(footerbg.png) repeat-x 0 top; + position: relative; + margin-top: -40px; + clear: both; +} + +.header, .footer +{ + width: 750px; + margin-right: auto; + margin-left: auto; +} + +.wrapper +{ + width: 100%; +} + +#top, #top-small, #bottom +{ + width: 100%; +} + +#top +{ + color: #000; + height: 230px; + background: #fff url(headerbg.png) repeat-x 0 top; + position: relative; +} + +#top-small +{ + color: #000; + height: 60px; + background: #fff url(headerbg.png) repeat-x 0 top; + position: relative; +} + +#bottom +{ + color: #222; + background-color: #fff; +} + +.top, .top-small, .middle, .bottom +{ + width: 750px; + margin-right: auto; + margin-left: auto; +} + +.top +{ + padding-top: 40px; +} + +.top-small +{ + padding-top: 10px; +} + +#middle +{ + width: 100%; + height: 100px; + background: url(middlebg.png) repeat-x; + border-top: 2px solid #fff; + border-bottom: 2px solid #b2b2b2; +} + +.app-welcome +{ + margin-top: 25px; +} + +.app-name +{ + color: #000; + font-weight: 700; +} + +.bottom +{ + padding-top: 50px; +} + +#left +{ + width: 350px; + float: left; + padding-right: 25px; +} + +#right +{ + width: 350px; + float: right; + padding-left: 25px; +} + +.align-left +{ + text-align: left; +} + +.align-right +{ + text-align: right; +} + +.align-center +{ + text-align: center; +} + +ul.links +{ + margin: 0; + padding: 0; +} + +ul.links li +{ + list-style-type: none; + font-size: 14px; +} + +form +{ + border-style: none; +} + +fieldset +{ + border-style: none; +} + +input +{ + color: #222; + border: 1px solid #ccc; + font-family: sans-serif; + font-size: 12px; + line-height: 16px; +} + +input[type=text], input[type=password] +{ + width: 205px; +} + +input[type=submit] +{ + background-color: #ddd; + font-weight: 700; +} + +/*Opera Fix*/ +body:before +{ + content: ""; + height: 100%; + float: left; + width: 0; + margin-top: -32767px; +} diff --git a/build/lib/lbbulk/static/pyramid-small.png b/build/lib/lbbulk/static/pyramid-small.png new file mode 100644 index 0000000..a5bc0ad Binary files /dev/null and b/build/lib/lbbulk/static/pyramid-small.png differ diff --git a/build/lib/lbbulk/static/pyramid.png b/build/lib/lbbulk/static/pyramid.png new file mode 100644 index 0000000..347e055 Binary files /dev/null and b/build/lib/lbbulk/static/pyramid.png differ diff --git a/build/lib/lbbulk/static/transparent.gif b/build/lib/lbbulk/static/transparent.gif new file mode 100644 index 0000000..0341802 Binary files /dev/null and b/build/lib/lbbulk/static/transparent.gif differ diff --git a/build/lib/lbbulk/templates/mytemplate.pt b/build/lib/lbbulk/templates/mytemplate.pt new file mode 100644 index 0000000..b4da3e9 --- /dev/null +++ b/build/lib/lbbulk/templates/mytemplate.pt @@ -0,0 +1,73 @@ + + + + The Pyramid Web Framework + + + + + + + + + + +
+
+
+
pyramid
+
+
+
+
+

+ Welcome to ${project}, an application generated by
+ the Pyramid Web Framework. +

+
+
+
+
+
+

Search documentation

+
+ + +
+
+ +
+
+
+ + diff --git a/build/lib/lbbulk/view/__init__.py b/build/lib/lbbulk/view/__init__.py new file mode 100644 index 0000000..8267c26 --- /dev/null +++ b/build/lib/lbbulk/view/__init__.py @@ -0,0 +1,7 @@ +from pyramid.response import Response +from pyramid.view import view_config + + +@view_config(route_name='home', renderer='../templates/mytemplate.pt') +def my_view(request): + return {'project': 'LBBulk'} \ No newline at end of file diff --git a/dist/LBBulk-0.1-py3.2.egg b/dist/LBBulk-0.1-py3.2.egg new file mode 100644 index 0000000..56ec2cb Binary files /dev/null and b/dist/LBBulk-0.1-py3.2.egg differ diff --git a/lbbulk/__init__.py b/lbbulk/__init__.py index 93f7ddb..46884a8 100644 --- a/lbbulk/__init__.py +++ b/lbbulk/__init__.py @@ -1,6 +1,7 @@ from pyramid.config import Configurator from sqlalchemy import engine_from_config from lbbulk.config.routing import make_routes +from pyramid_restler import includeme from lbbulk.model import Base, metadata, DBSession @@ -13,6 +14,8 @@ def main(global_config, **settings): engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.bind = engine + includeme(config) config.include('pyramid_chameleon') make_routes(config) + config.enable_POST_tunneling() return config.make_wsgi_app() \ No newline at end of file diff --git a/lbbulk/config/routing.py b/lbbulk/config/routing.py index d610687..b7cd1c3 100644 --- a/lbbulk/config/routing.py +++ b/lbbulk/config/routing.py @@ -1,6 +1,11 @@ +# import lbbulk.model +from lbbulk.model.Registro import RegistroContextFactory +from lbbulk.view.restfulview import RegCustomView + def make_routes(config): """ Create routes """ config.add_static_view('static', 'static', cache_max_age=3600) - config.add_route('home', '/') \ No newline at end of file + config.add_route('home', '/') + config.add_restful_routes('registro', RegistroContextFactory, view=RegCustomView) \ No newline at end of file diff --git a/lbbulk/model/Registro.py b/lbbulk/model/Registro.py index e87dca4..d294300 100644 --- a/lbbulk/model/Registro.py +++ b/lbbulk/model/Registro.py @@ -1,7 +1,8 @@ from sqlalchemy import Table, Column, Integer, \ String, join, ForeignKey from sqlalchemy.orm import column_property -from lbbulk.model import Base, metadata +from pyramid_restler.model import SQLAlchemyORMContext +from lbbulk.model import Base, metadata, session # define two Table objects bulk_sources = Table('lb_bulk_sources', metadata, @@ -23,4 +24,11 @@ registro = join(bulk_sources, bulk_upload) # map to it class Registro(Base): __table__ = registro - id_source = column_property(bulk_sources.c.id_source, bulk_upload.c.id_source) \ No newline at end of file + id_source = column_property(bulk_sources.c.id_source, bulk_upload.c.id_source) + +class RegistroContextFactory(SQLAlchemyORMContext): + + entity = Registro + + def session_factory(self): + return session \ No newline at end of file diff --git a/lbbulk/model/__init__.py b/lbbulk/model/__init__.py index 49efc4f..5c6348b 100644 --- a/lbbulk/model/__init__.py +++ b/lbbulk/model/__init__.py @@ -4,4 +4,5 @@ from sqlalchemy.orm import scoped_session, sessionmaker metadata = MetaData() Base = declarative_base() -DBSession = scoped_session(sessionmaker()) \ No newline at end of file +DBSession = scoped_session(sessionmaker()) +session = DBSession \ No newline at end of file diff --git a/lbbulk/templates/mytemplate.pt b/lbbulk/templates/mytemplate.pt index b4da3e9..1d9416b 100644 --- a/lbbulk/templates/mytemplate.pt +++ b/lbbulk/templates/mytemplate.pt @@ -31,11 +31,12 @@
-

Search documentation

-
- - -
+

Restful Views

+