[pylons-discuss] Re: how to return a http exception in json ?

2014-04-01 Thread Chung WONG
Thanks for all the helps :) On Monday, March 31, 2014 8:11:20 PM UTC+11, Chung WONG wrote: For example, there is a view returns a http exception to a request: @view_config(route_name='route', renderer='json', request_method='GET') def view(request): *return

[pylons-discuss] tutorial or open source projects that uses Pylons?

2014-04-01 Thread accesswifi
Newbie to Pylons (in fact, fairly new to Python). Lots of programming experiences in Java, C++ and Objective-C though. Still learning Pylons and I found the wiki tutorial is excellent. However, there are a few areas that I am interested: 1. the wiki tutorial is a bit light on authentication and

[pylons-discuss] I am new to sqlalchemy. Could anyone explain to me what's going on in relationship() api?

2014-04-01 Thread luoyingshenfu
Hello, everyone, I am starting to use sqlalchemy now and really got frustrated in understanding the purpose of relationship(). For example, if I make a model with a foreign key like the one in sqlalchemy's official docs: class Parent(Base): __tablename__ = 'parent' id =

[pylons-discuss] file uri scheme and wsgi

2014-04-01 Thread Ichabod Coolidge
I want to serve images via file:/// scheme as all clients in an internal network mount the same image filer. A test: A simple html file on disk correctly loads and renders an image via a file:/// URI: img src=file:///tmp/test.png/img ..the equivalent html served from pyramid/wsgi does not:

Re: [pylons-discuss] tutorial or open source projects that uses Pylons?

2014-04-01 Thread Paul Everitt
Here is a rewrite of the tutorial which goes into more depth, section-by-section: http://docs.pylonsproject.org/projects/pyramid/en/master/quick_tutorial/index.html It has a little more on authentication and authorization and is aimed at Jinja2. It might still be too light for your needs.

Re: [pylons-discuss] file uri scheme and wsgi

2014-04-01 Thread Arndt Droullier
Browser security prevents loading local files referenced from network loaded html pages. Mixing file:// and http:// protocols won't work. img src=file:///tmp/test.png/img -- Arndt Droullier, Nive GmbH, Köln, Germany, www.nive.co -- You received this message because you are subscribed to the

Re: [pylons-discuss] tutorial or open source projects that uses Pylons?

2014-04-01 Thread Mário Idival
I created a tutorial (a schedule), uses a bit of SQLAlchemy, some comments are on en, but Python is universal:) SqlAlchemy + Jinja2 https://github.com/GruPy-RN/agenda_pyramid Mário Idival *Twitter *: *@marioigd* *Facebook*: *mario.idival* *User Linux : **#554446* Skype*: marioidival*

Re: [pylons-discuss] I am new to sqlalchemy. Could anyone explain to me what's going on in relationship() api?

2014-04-01 Thread tonthon
Hi, you should write to sqlalchemy's mailing list : http://www.sqlalchemy.org/support.html#mailinglist You'll find a definition of foreign keys here (it's an sql functionnality): http://docs.sqlalchemy.org/en/rel_0_9/core/constraints.html#defining-foreign-keys For the relationship function,

[pylons-discuss] Re: [SqlAlchemy] how to return a primary key in scoped session?

2014-04-01 Thread Wyatt Baldwin
On Tuesday, April 1, 2014 2:46:06 AM UTC-7, Chung WONG wrote: For example: *DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))* *class User(Base):* *id = Column(Integer,Sequence('user_id_seq'), primary_key=True)* *username = Column(Unicode(255),

[pylons-discuss] Re: [SqlAlchemy] how to return a primary key in scoped session?

2014-04-01 Thread Jonathan Vanasco
Assuming this is SqlAlchemy, your only option is to call flush(). `flush()` simply tells the session to talk to the database. if you don't call `flush()` or `commit()`, SqlAlchemy doesn't talk to the database, and has no way of obtaining an id. i think requiring an explicit command to talk to

[pylons-discuss] Re: [SqlAlchemy] how to return a primary key in scoped session?

2014-04-01 Thread Chung WONG
*def some_view(request):* *some_code(sqlalchemy_related)* *return s http://user.id/ome_response* if the above execution of view doesn't trigger any error, the transaction is auto committed with scoped session. In case of having an error, the transaction aborted. I guess the view

Re: [pylons-discuss] Re: [SqlAlchemy] how to return a primary key in scoped session?

2014-04-01 Thread Michael Merickel
If you are using the ZopeTransactionExtension combined with pyramid_tm then the view is irrelevant. pyramid_tm is a tween that wraps everything that happens while processing a request (for the purposes of this discussion). You should be clear up front that the DBSession is wrapping a database