Skip to content

Instantly share code, notes, and snippets.

View larsks's full-sized avatar

Lars Kellogg-Stedman larsks

View GitHub Profile
@larsks
larsks / gist:111839
Created May 14, 2009 19:30
An example of using the itertools module
# 2009-05-14 13:49 < spdr-:#python> hello. is there an elegant way
# to loop for at most N iterations? for a in collection: ...
# 2009-05-14 13:49 < KirkMcDonald:#python> spdr-:
for x in itertools.islice(collection, N):
pass
class Person (Entity):
using_options (tablename = 'person')
full_name = Field(String)
given_name = Field(String)
sur_name = Field(String)
affiliation = Field(String)
account = OneToMany('Account')
Just to be painfully complete the solution was:
subquery = select([Taggable.c.id], query._criterion, from_obj= query._from_obj).as_scalar()
names.select (exists ([names.c.id], and_(names.c.id == obj_tags.c.name_id, obj_tags.c.parent_id==Taggable.c.id , Taggable.c.id.in_ ( subquery) ))
which works in 0.4.1, but not in 0.3.11
Thanks for the help!
Mexican Chocolate Tofu Pudding
* Sign In to E-Mail
* Print
* Reprints
* ShareClose
o Linkedin
o Digg
o Facebook
o Mixx
class Webapp:
_cp_config = {
'/static': {
'tools.staticdir.dir': os.path.join(os.path.dirname(__file__),'/static'),
'tools.staticdir.on': True
}
}
def index(self):
def cp_config(cfg):
'''Add cherrypy configuration dictionary to the _cp_config
attribute of a method.'''
def decorate(f):
setattr(f, '_cp_config', cfg)
return f
return decorate
wyss.harvard.edu. 10800 IN A 128.103.241.91
wyss.harvard.edu. 300 IN MX 10 magix.seas.harvard.edu.
wyss.harvard.edu. 300 IN MX 10 mirax.seas.harvard.edu.
stage.wyss.harvard.edu. 10800 IN CNAME stage2.wds-appdev.cadm.harvard.edu.
www.wyss.harvard.edu. 10800 IN CNAME prod2.wds-appprod.cadm.harvard.edu.
git svn init -s $svnrepo
git svn fetch
git rebase --onto trunk --root
git svn dcommit
>>> import gpgme
>>> ctx = gpgme.Context()
>>> data = open('sample.sh.asc')
>>> import sys
>>> sig = ctx.verify(data, None, sys.stdout)
#!/bin/sh
echo "Hello, world."
>>> sig[0].validity
#!/bin/sh
cd $HOME
fs=$(df -P . | tail -1 | sed -n 's|\([^:]*:/[^/]*/[^/]*\)/.*|\1|p')
quota -s | head -2
quota -s | grep -A1 "$fs" | head -2 | sed 's|^'"$fs"'.*|'"$fs"'|'