Paul's Programming Notes     Archive     Feed     Github

Two Column Match - Flask + HandsOnTable

I'm getting more comfortable with Flask, so I decided to experiment with Google App Engine + Flask + HandsOnTable.

Here's the application I made: http://twocolumnmatch.appspot.com/match

It takes the contents of the 2nd column and matches it to the rows of the first column. Just press the "Match" button to see what it does.

I've found myself doing what this application does a few times, but I manually create two python lists and compare them in IDLE. This application streamlines that process quite a bit.

Here's the code: https://github.com/pawl/2ColumnMatch

SQLalchemy - Simple Select Query

from sqlalchemy import create_engine, MetaData, Table

engine = create_engine('sqlite:///cars.db', echo=False)
metadata = MetaData(bind=engine)

table = Table('cars', metadata)
stmt = table.select()
for row in stmt.execute():
    print row

AttributeError: 'dict' object has no attribute '_set_parent_with_dispatch' - SQLalchemy



The documentation says: "Keyword arguments can be specified by specifying the last argument as a dictionary"

So you will need to change this:
__table_args__ = (
{'sqlite_autoincrement': True},
            UniqueConstraint('filename', 'path')
            )

to this:
__table_args__ = (
            UniqueConstraint('filename', 'path'),
            {'sqlite_autoincrement': True}

            )

jPanelMenu Causing Document.Ready() To Run Twice

This line in jquery.jpanelmenu.js is the cause:
$('body > *').not(jP.menu + ', ' + jP.options.excludedPanelContent).wrapAll('<div class="' + 'jPanelMenu-panel' + '"/>');

You will need to comment it out and wrap everything in your body tag manually with:
<div class="jPanelMenu-panel" style="position: relative; left: 0px;">
</div>

The end result will look like:
<body>
<div class="jPanelMenu-panel" style="position: relative; left: 0px;">
all your code....
</div>
</body>


This page helped me figure it out: http://doctype.com/trying-jquery-wrapall-seems-wrap-content-twice