This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""The application's model objects""" | |
import sqlalchemy as sa | |
from sqlalchemy import orm | |
import re | |
from central_library.model import meta | |
def init_model(engine): | |
"""Call me before using any of the tables or classes in the model""" | |
sm = orm.sessionmaker(autoflush=True, autocommit=False, bind=engine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pylons.decorators import rest | |
class SomeController(BaseController): | |
@rest.dispatch_on(POST='some_action_POST') | |
def some_action(self): | |
pass | |
def some_action_POST(self): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jon@euterpe:~/Desktop$ port outdated | |
The following installed ports are outdated: | |
curl 7.19.2_0 < 7.19.3_0 | |
ImageMagick 6.4.8-1_1 < 6.4.8-7_0 | |
rrdtool 1.3.5_0 < 1.3.6_0 | |
sqlite3 3.6.10_0 < 3.6.10_1 | |
tk 8.5.6_0 < 8.5.6_1 | |
jon@euterpe:~/Desktop$ sudo port upgrade tk | |
---> Fetching tk | |
---> Verifying checksum(s) for tk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jon@euterpe:~/Desktop$ sudo port clean --all tk | |
Password: | |
---> Cleaning tk | |
Warning: Distfiles directory '/opt/local/var/macports/distfiles/tcltk' may contain distfiles needed for other ports, use the -f flag to force removal | |
jon@euterpe:~/Desktop$ ls /opt/local/var/macports/distfiles/tcltk | |
tcl8.5.5-src.tar.gz tk8.5.5-src.tar.gz | |
jon@euterpe:~/Desktop$ sudo port clean --all -f tk | |
---> Cleaning tk | |
jon@euterpe:~/Desktop$ sudo port -d upgrade tk | |
DEBUG: Found port in file:///opt/local/var/macports/sources/rsync.macports.org/release/ports/x11/tk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from app_a import app as appA | |
from app_b import wsgi_app as appB | |
from paste.urlmap import URLMap | |
map_app = URLMap() | |
map_app['/blog'] = appA | |
map_app['/forum'] = appB | |
# now, just treat map_app as your WSGI app. | |
# A request for /blog/2009/09/hello_world will go to appA as /2009/09/hello_world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT sites.name AS sites_name, sites.longname AS sites_longname, sites.rank AS sites_rank, sites.hidden AS sites_hidden, sites.up AS sites_up, sites.size AS sites_size, sites.region AS sites_region, sites.country AS sites_country, sites.gadmins AS sites_gadmins, sites.speed AS sites_speed, sites.comments AS sites_comments | |
FROM sites | |
WHERE sites.up = %s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FakeConnection(object): | |
def __init__(self): | |
self.storage = None | |
def execute(self, ddl): | |
self.storage = ddl | |
def __str__(self): | |
return self.storage | |
useless = {} | |
dialects = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---> Building xorg-libX11 | |
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_x11_xorg-libX11/work/libX11-1.2" && make all " returned error 2 | |
Command output: _XOpenDisplay in OpenDis.o | |
"__XlcCurrentLC", referenced from: | |
__XF86LoadQueryLocaleFont in Font.o | |
__XF86LoadQueryLocaleFont in Font.o | |
"__XcmsDeleteCmapRec", referenced from: | |
_XFreeColormap in FreeCmap.o | |
"__XCloseLC", referenced from: | |
_XCloseOM in OMWrap.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(testpython)jon@euterpe:~/test$ python sertest/test_speed.py | |
5000 total records (0.596s) | |
ser_json (0.028s) 718391 bytes | |
ser_cjson (0.032s) 718391 bytes | |
ser_json_compressed (0.075s) 292916 bytes | |
ser_cjson_compressed (0.078s) 292916 bytes | |
serde_json (0.076s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import simplejson | |
import cjson | |
import zlib | |
import string | |
import random | |