is there a way to move config.add_route out of __init__.py?

2013-08-02 Thread Chung WONG
I am wondering if it is possible to group view_config and add_route as close as possible? Anyone have an idea? thanks -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an em

having error when using buildout for deploying

2013-08-27 Thread Chung WONG
Hi all, I am learning how to deploy to google app engine on this link . However , I am stuck at ~/ $ cd newproject ~/newproject $ /usr/bin/python2.7 bootstrap.py --distribute After typing the comma

Re: having error when using buildout for deploying

2013-08-28 Thread Chung WONG
thanks Thmoas On Wednesday, August 28, 2013 11:01:35 AM UTC+10, Chung WONG wrote: > > Hi all, > > I am learning how to deploy to google app engine on this > link<http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/deployment/gae_buildout.html> > . &

Re: having error when using buildout for deploying

2013-08-28 Thread Chung WONG
s, temp_dir) File "/tmp/newproject/eggs/rod.recipe.appengine-2.0.2-py2.7.egg/rod/recipe/appengine/__init__.py", line 274, in copy_packages self.write_pkg_resources(ws, lib) File "/tmp/newproject/eggs/rod.recipe.appengine-2.0.2-py2.7.egg/rod/recipe/appengine/__init__.py&quo

question about __call__ in view callable class

2013-09-03 Thread Chung WONG
Hi all, in this doc, it said a view callable class *must have* __init__ and __call__ methods, however, in https://github.com/mcdonc/bikes/blob/master/app7.py , the view callable cl

Re: question about __call__ in view callable class

2013-09-03 Thread Chung WONG
thanks all. so to conclude, if @view_config() is used, __call__ is not necessary(or useless?) if the callable is called by add_view(), then __call__ is need. On Wednesday, September 4, 2013 9:49:06 AM UTC+10, Chung WONG wrote: > > Hi all, > > in > this<http://docs.pylonspr

Re: question about __call__ in view callable class

2013-09-03 Thread Chung WONG
Thanks guys On Wednesday, September 4, 2013 9:49:06 AM UTC+10, Chung WONG wrote: > > Hi all, > > in > this<http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/views.html#defining-a-view-callable-as-a-class> > doc, > it said a view callable class *must

struggling with traversal

2013-09-04 Thread Chung WONG
Hi all, I have read all the docs available on pyramid's website, however I still don't really understand how to get a basic traversal app working. The hello world example is good but I am not able to extend it. The ZODB wiki is good too but it is a bit too much information to me with auth and z

Re: struggling with traversal

2013-09-14 Thread Chung WONG
5, 2013 10:18:05 AM UTC+10, Chung WONG wrote: > > Hi all, > > I have read all the docs available on pyramid's website, however I still > don't really understand how to get a basic traversal app working. > The hello world example is good but I am not able to extend it. The

[pylons-discuss] templating dependency problem with pyramid=1.5a2

2013-09-25 Thread Chung WONG
Hi, I have just upgrade pyramid to 1.5a2 to test the new dependences. *pyramid_mako* has added to *install_requires* in *setup.py* then i ran *env/bin/python setup.py develop* and pyramid_mako was installed. both tried including *pyramid.mako* in *development.ini *or * config.include('pyramid_

[pylons-discuss] Re: templating dependency problem with pyramid=1.5a2

2013-09-26 Thread Chung WONG
Thanks guys, I upgrade pyramid_debugtoolbar to 1.0.8 and it is working now On Thursday, September 26, 2013 11:01:01 AM UTC+10, Chung WONG wrote: > > Hi, > > I have just upgrade pyramid to 1.5a2 to test the new dependences. > > *pyramid_mako* has added to *install_requ

[pylons-discuss] authenticated_userid returned None

2013-09-29 Thread Chung WONG
Hi all, I am learning pyramid auth and I found i couldn't get authenticated_userid in a view callable. the auth is done via ajax, which posts email and password to the login_view # views.py @view_config( route_name='login', renderer='json') def login_view(request): *# print request* #

Re: [pylons-discuss] authenticated_userid returned None

2013-09-29 Thread Chung WONG
der is not executed at all while Root factory is loaded successfully. On Sunday, September 29, 2013 11:28:43 PM UTC+10, aodag wrote: > > Hi > > Check the value of 'user' and 'user.groups' in groupfinder. > If groupfinder returns None, authenticated_userid ret

Re: [pylons-discuss] authenticated_userid returned None

2013-09-29 Thread Chung WONG
08:24 PM UTC+10, Chung WONG wrote: > > Thanks > > I actually found groupfinder wasn't get executed at all. > > My settings are simply a copy from > michael.merickel<https://github.com/mmerickel/pyramid_auth_demo/blob/master/1.group_security/d

[pylons-discuss] how to save csrf_token into cookies?

2013-10-16 Thread Chung WONG
Hi all, I am trying to implement csrf checking on a RESTful system. I am using beaker session factory and I can get the token successfully by def myview(render="json",route="csrf_token"): token=request.session.get_csrf_token() return {"csrf_token":token} However, it would be good if th

[pylons-discuss] check_csrf_token() missing in request.session

2013-10-16 Thread Chung WONG
according to this , In request handling code, you can check the presence and validity of a CSRF token with session.check_csrf_token(request). If

Re: [pylons-discuss] check_csrf_token() missing in request.session

2013-10-17 Thread Chung WONG
Thanks Michael, That means the doc is wrong about that part. On Thursday, October 17, 2013 3:37:28 PM UTC+11, Michael Merickel wrote: > > check_csrf_token is not on the session object. It is a function that is in > the pyramid.session module. > On Oct 16, 2013 11:15 PM, "Chung

[pylons-discuss] Did anyone try velruse with ajax?

2013-11-13 Thread Chung WONG
Velruse is working great with form posting. Unfortunately, it doesn't support ajax workflow. Does anyone have experience using velruse with ajax? How do you handle with the callback path? Thanks. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" g

[pylons-discuss] Re: Did anyone try velruse with ajax?

2013-11-14 Thread Chung WONG
It looks great. Is it using any ajax to handle the authentication as I couldn't find anything related. For the run-server.sh, it is executing pip and python globally which is not playing well with virtualenv. Thanks. On Wednesday, November 13, 2013 10:29:04 PM UTC+11, Chung WONG

[pylons-discuss] Re: Global CSRF protection with exemptions

2013-11-14 Thread Chung WONG
you can also using this to check the csrf token in your view and throw exceptions too On Thursday, November 14, 2013 12:13:10 PM UTC+11, Sergei Bezborodko wrote: > > Hello,

[pylons-discuss] Re: Did anyone try velruse with ajax?

2013-11-14 Thread Chung WONG
aully? btw, I have to confess I am new to python as well :) On Wednesday, November 13, 2013 10:29:04 PM UTC+11, Chung WONG wrote: > > Velruse is working great with form posting. Unfortunately, it doesn't > support ajax workflow. > > Does anyone have experience using velruse

[pylons-discuss] Velruse with google oauth2

2013-11-17 Thread Chung WONG
I am modifying the examples of velruse pyramid_plugin example to make it work with google oauth2. Howerver I keep getting Error: redirect_uri_mismatch back from google What I have changed were minimal, not sure what I miss

[pylons-discuss] Re: Velruse with google oauth2

2013-11-18 Thread Chung WONG
alright, it turned out there was something wrong with my google api settings. to make it work, *Web Origin:* http://localhost:5000 has to be *Web Origin:* http://localhost <http://localhost:5000/> it doesn't accept any port number. On Sunday, November 17, 2013 7:46:09 PM UTC+11,

[pylons-discuss] WebTest with check_csrf configured views

2013-12-04 Thread Chung WONG
HI list, given a route *config.add_route('connect', '/connect')* and a view *@view_config(route_name='connect', check_csrf=True)* *def get_connection():* * doWork()* and in a test: def setUp(self): from . import main app = main({}, **settings)

Re: [pylons-discuss] Pyramid 1.5a3 released

2013-12-11 Thread Chung WONG
it said "removed from the doc" but didn't mean removed pyramid_beaker completely. I guess you can still use pyramid_beaker On Wednesday, December 11, 2013 6:15:12 PM UTC+11, Mike Orr wrote: > > On Tue, Dec 10, 2013 at 12:13 PM, Chris McDonough > > > wrote: > > Pyramid 1.5a3 has been released.

[pylons-discuss] How to use pyramid_mailer.debug?

2013-12-17 Thread Chung WONG
The doc said: pyramid.includes = pyramid_mailer.debug ... pyramid_debugtoolbar pyramid_tm but I got an error with it: * ImportError: No module named debug* I have tried to include both pyramid_mailer and pyramid_mai

[pylons-discuss] Re: How to use pyramid_mailer.debug?

2013-12-17 Thread Chung WONG
PGP SIGNED MESSAGE- > Hash: SHA1 > > On 12/17/2013 05:53 PM, Chung WONG wrote: > > The doc > > <http://docs.pylonsproject.org/projects/pyramid_mailer/en/latest/> > > said: > > > > pyramid.includes = pyramid_mailer.debug ... pyramid_debugtoolbar &g

[pylons-discuss] Re: Authenticating a user (beaker + memcached) and giving them a session

2014-01-27 Thread Chung WONG
have a look here generally it uses remember and forget which make use of cookies. On Monday, January 27, 2014 6:41:58 PM UTC+11, infMt wrote: > > Sorry if this seems like such a naiv

[pylons-discuss] pyramid+uwsgi+nginx, unix socket connection refused

2014-02-26 Thread Chung WONG
Hi list, There is a socket connection refused problem in nginx(uwsgi?) that I have no idea how to fix it. I am not even sure if I am on the right track as I am following the instructions here I hope someone can shed some light on it. Here ar

[pylons-discuss] Re: pyramid+uwsgi+nginx, unix socket connection refused

2014-02-26 Thread Chung WONG
thanks Roberto, I removed the listen param in the .ini and that particular error has gone. However, there are another two errors which I think they are related to Paste. Starting uWSGI 2.0.1 (64bit) on [Wed Feb 26 22:02:36 2014] *compiled with version: 4.8.2 on 24 February 2014 20:28:3

[pylons-discuss] Re: pyramid+uwsgi+nginx, unix socket connection refused

2014-02-26 Thread Chung WONG
For some reason, after upgraded PasteDeploy from 1.5.0 to 1.5.2, both errors have gone. Problem Solved! Thanks On Wednesday, February 26, 2014 9:31:39 PM UTC+11, Chung WONG wrote: > > Hi list, > > There is a socket connection refused problem in nginx(uwsgi?) that I have > no ide

[pylons-discuss] calling other view callables in a view callable?

2014-02-28 Thread Chung WONG
Hi all, Say If there are two views as below: *class ViewOne(object):* *def __init__(self, request):* *self.request=request* *@view_config(route_name='a', renderer='json')* *def view_a(self):* *return {'viewA: some_dict}* *class ViewTwo(object):* *def __init__(sel

[pylons-discuss] Re: calling other view callables in a view callable?

2014-02-28 Thread Chung WONG
Thanks Tres, I ended up doing the same thing you suggested. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To pos

[pylons-discuss] how to organise files in model package using sqlachemy?

2014-02-28 Thread Chung WONG
I have a *models.py* that contains 10 classes. And I am trying to move all classes out of that file and put each class into its own file under a models package. I am using the alternative(at bottom of page) method mentioned here

[pylons-discuss] Re: how to organise files in model package using sqlachemy?

2014-03-02 Thread Chung WONG
thanks Vincent and Wyatt. Can I say that even though importing every model into __init__.py is tedious, it is the best approach available at this moment? -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop

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

2014-03-31 Thread Chung WONG
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 HTTPUnprocessableEntity(detail='details', comment='comment', body_template='body_template')* it returned a full htm

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

2014-03-31 Thread Chung WONG
eturned a HTML Page. On Monday, March 31, 2014 9:38:19 PM UTC+11, Mariano Mara wrote: > > > > On 31/03/14 06:11, Chung WONG wrote: > > For example, there is a view returns a http exception to a request: > > @view_config(route_name='route', renderer='js

[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') >

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

2014-04-01 Thread Chung WONG
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), unique=True)* *def some_view(request):* *user=User(username='me')*

[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 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 h

[pylons-discuss] Using pyramid_mailer with celery beat

2014-06-25 Thread Chung WONG
Let's say there is a task: from pyramid_mailer import get_mailer from celery import Celery from celery.schedules import crontab class Config: CELERYBEAT_SCHEDULE = { 'every-minute': { 'task': 'send_mail', 'schedule': crontab(minute='*/1'), *'args':

[pylons-discuss] Re: Making view available only to unauthenticated user

2014-08-30 Thread Chung WONG
I am not sure if custom predicate is the elegant way http://docs.pylonsproject.org/docs/pyramid/en/1.5-branch/narr/urldispatch.html#custom-route-predicates On Saturday, August 30, 2014 9:21:48 PM UTC+10, pyramidX wrote: > > What is the recommended approach to making a view available only to > *u