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
def _decodepdf(filename): | |
rsrcmgr = PDFResourceManager() | |
retstr = StringIO() | |
codec = 'utf-8' | |
laparams = LAParams() | |
device = TextConverter(rsrcmgr, retstr, codec=codec, laparams=laparams) | |
fp = file(filename, 'rb') | |
process_pdf(rsrcmgr, device, fp) |
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
>>> pprint(links) | |
[(u'http://www.scottsvilleny.org/uploads/2013%20earth%20day%20poster.pdf', | |
u'\xa0'), | |
(u'http://www.scottsvilleny.org/uploads/ScottsvilleFlyer.pdf', | |
<font face="georgia,palatino"><strong><font size="2">Scottsville Workshop Information</font></strong></font>), | |
(u'http://www.scottsvilleny.org/uploads/Scribble%20MapsHowToGuide.pdf', | |
<strong><font face="georgia,palatino" size="2">Scribble Map </font></strong>)] | |
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 BlogModel(Base): | |
__tablename__ = 'blogs' | |
id = Column(Integer, primary_key=True) | |
title = Column(Text) | |
posted = Column(DateTime) | |
content = Column(Text) | |
def __init__(self,title,posted,content): | |
self.title = title | |
self.posted = posted |
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
(chatterstats)administrator@anna:~/dev/chatterstats$ curl -i anna.duffnet.local:6543/posts.json | |
HTTP/1.1 200 OK | |
Content-Length: 96 | |
Content-Type: text/html; charset=UTF-8 | |
Date: Fri, 06 Sep 2013 19:15:42 GMT | |
Server: waitress | |
{'posts': [{'content': 'Hi.', 'posted': '2013-09-06 at 14:39:50', 'id': 1, 'title': 'First!'}]} | |
(chatterstats)administrator@anna:~/dev/chatterstats$ |
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
@view_config(route_name="/posts.json", renderer='templates/posts.pt') | |
def posts_view(request): | |
posts = [] | |
_p = DBSession.query(BlogModel) | |
for p in _p: | |
posts.append(p._json()) | |
retval = {"posts":posts} | |
return {"retval":retval} |
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
/barkingowl | |
/barkingowl/src/models | |
/barkingowl/src/models/__init__.py | |
/barkingowl/src/website/ | |
/barkingowl/src/website/barkingowl/models.py | |
within models.py i have: | |
from ...models import * |
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
[11:16:03] <blitz> ok so I have two tables, cards and shopping_carts | |
[11:16:51] <blitz> cards have a buy_cart_id that is a foreign key to a shopping cart, they also have a true/false flag called "offered_electronic" | |
[11:17:23] <blitz> I need to join all cards on shopping carts, but I need to reject every cart that includes any amount of cards where offered_electronic is set to 1 | |
[11:17:54] <blitz> so if atleast one card is set to 1, don't join any cards in that cart | |
create table shopping_carts( | |
cartid int not nul auto_increment primary key | |
); | |
create table cards( |
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 sqlalchemy import ( | |
Column, | |
ForeignKey, | |
Integer, | |
Text, | |
) | |
from sqlalchemy.orm import ( | |
scoped_session, | |
sessionmaker, |
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
# do import stuff ... | |
class MyModel(): | |
id = Column(Integer, primary_key=True) | |
name = Column(Text) | |
value = Column(Integer) | |
def __init__(self,name): | |
self.name = name |
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
(barkingowl)administrator@anna:~/dev/BarkingOwl/src/scraper$ fedmsg-relay | |
No handlers could be found for logger "moksha.hub" | |
Traceback (most recent call last): | |
File "/home/administrator/.virtualenvs/barkingowl/bin/fedmsg-relay", line 9, in <module> | |
load_entry_point('fedmsg==0.7.1', 'console_scripts', 'fedmsg-relay')() | |
File "/home/administrator/.virtualenvs/barkingowl/local/lib/python2.7/site-packages/fedmsg/commands/relay.py", line 81, in relay | |
command = RelayCommand() | |
File "/home/administrator/.virtualenvs/barkingowl/local/lib/python2.7/site-packages/fedmsg/commands/__init__.py", line 52, in __init__ | |
self.config = self.get_config() | |
File "/home/administrator/.virtualenvs/barkingowl/local/lib/python2.7/site-packages/fedmsg/commands/__init__.py", line 60, in get_config |
OlderNewer