PyGotham, 6/9, need volunteer to give Pyramid Tutorial
URGENT: need a volunteer to give a Pyramid tutorial in NYC for#*pygotham*https://twitter.com/#!/search/%23pygotham - chris can't make it and they're going to do django instead ARGH https://twitter.com/zzzeek/status/209700787339800576 If anyone is available, get in touch with Mike Bayer. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To view this discussion on the web visit https://groups.google.com/d/msg/pylons-discuss/-/wo8QCJOzX_sJ. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: a question for anyone using formencode and pylons/pyramid ...
Two possible alternatives # if you had another reason for a list comprehension def unicode_wrap(listed): return [ unicode(i) for i in listed ] def unicode_wrap(listed): return map(unicode, listed) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: questions about integrating deform into production environment
On Feb 3, 1:16 pm, Jonathan Vanasco jonat...@findmeon.com wrote: 1- copy deform's /static files to app/static/deform 2- symlink deform/static to app/static/deform ( or an option of your choice ) In apache, I've always done something like: Alias /deform/static /var/www/pyr27/lib/python2.7/site-packages/ deform-0.9.3-py2.7.egg/deform/static For nginx: location ^~ /deform/static { alias /var/www/pyr27/lib/python2.7/site-packages/deform-0.9.3- py2.7.egg/deform/static; } In order to prevent Apache or Nginx from seeing the requests, the webserver itself needs to handle those before handing it to the wsgi process. If you are using mod_wsgi, merely having the files in the right place only works if you are using a mod_rewrite that tests -f and then passes to mod_wsgi. If you're running with WSGIScriptAlias, you need to make sure your alias is set before the ScriptAlias line since Apache parses config files in order. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: questions about integrating deform into production environment
On Feb 3, 1:16 pm, Jonathan Vanasco jonat...@findmeon.com wrote: 1- copy deform's /static files to app/static/deform 2- symlink deform/static to app/static/deform ( or an option of your choice ) In apache, I've always done something like: Alias /deform/static /var/www/pyr27/lib/python2.7/site-packages/ deform-0.9.3-py2.7.egg/deform/static For nginx: location ^~ /deform/static { alias /var/www/pyr27/lib/python2.7/site-packages/deform-0.9.3- py2.7.egg/deform/static; } In order to prevent Apache or Nginx from seeing the requests, the webserver itself needs to handle those before handing it to the wsgi process. If you are using mod_wsgi, merely having the files in the right place only works if you are using a mod_rewrite that tests -f and then passes to mod_wsgi. If you're running with WSGIScriptAlias, you need to make sure your alias is set before the ScriptAlias line since Apache parses config files in order. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: questions about integrating deform into production environment
On Feb 6, 12:29 pm, Jonathan Vanasco jonat...@findmeon.com wrote: ( which would be nginx or varnish ). If you are using Varnish, designing your VCL well enough would fix the requests from hitting the backend too frequently and would be almost hands-off as you wouldn't have any external config file for apache/ nginx to change if you upgraded deform. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: questions about integrating deform into production environment
If you wanted to automate, put it in the git hooks, puppet or capistrano or whatever deployment engine configs. I can see a use case for having the Pyramid app do it, but, your deployment scripts are a better place to make those decisions, though, it is a little more than just dropping a Pyramid app into place. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: loading before all modules and defer to middleware
Matthew Housden documented this on his blog: http://matthewhousden.com/python/new-relic-and-pyramid/ basically: import newrelic.agent newrelic.agent.initialize('path/to/newrelic.ini', 'development') application = config.make_wsgi_app() return newrelic.agent.wsgi_application()(application) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: deform: is it possible to invalidate a form / field manually ?
You can set either a field validation: Validation function: database_username_re = re.compile('^[a-z0-9_]{2,16}$', re.IGNORECASE) def validate_database_param(param): if database_username_re.match(param): return True else: return unicode('Value must be between 2 and 16 characters and can only contain uppercase and lowercase alphanumeric characters or an underscore') Schema definition: databasename = colander.SchemaNode( colander.String(), validator=colander.Function(validate_database_param), title = 'Database Name', ) Or, in your actual Schema call: def validate_userpass_existing(form, value): checking to make sure we have a user/pass OR an existing user exc = None if value['databasename']: db = DBSession.query(cp_database). \ filter(cp_database.device_id==value['device_id']). \ filter(cp_database.databasename==value['databasename']).first() if db: exc = colander.Invalid(form, 'Database name already in use.') exc['databasename'] = 'Cannot create a duplicate database' if exc: raise exc schema = DBAddSchema(validator=validate_userpass_existing). \ bind(user_list=grants, device_list=devices, \ csrf_token=request.session.get_csrf_token()) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: deform: is it possible to invalidate a form / field manually ?
Forgot to add: Validation on the field takes place on form submission. Validation on the Schema takes place after all field validations are validated. So, an error on a field where it has some constraint will not fire off your check on the Schema. So, if someone put a short password in, and you are checking to see if the user exists on the Schema validation, it actually will not check the username until the password validation passes. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: chameleon: How to check whether user is logged in or not
On Jan 31, 2:22 am, Kesav Kumar Kolla kesavko...@gmail.com wrote: I want to conditionally include some links in my chameleon template. How to write condition in chameleon to check whether user is logged in? Making A “User Object” Available as a Request Attribute (first paragraph) http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/authentication.html allows you to make the User object part of the request object, at which point you can access the user object in your templates as request.user.username (if username is a valid field in your user object). -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Turbogears to Pyramid
On Feb 1, 2:36 pm, sajuptpm sajup...@gmail.com wrote: I have a project developed in turbogears, i want to move it to Pyramid, is it possible ??? I am using following feature of TG2 controller The closest thing to the controller structure from TG2 are handlers. while I documented a Pylons 1.0 - Pyramid the first week Pyramid became generally available, the app in question was originally a TurboGears 2.0 app: http://cd34.com/blog/framework/pylons-1-0-to-pyramid-1-0a1/ You might also look at the Ahket scaffolds which set up a Pyramid project to look a lot like a Pylons project. sqlalchemy supported tg2env I believe this is just a wrapper for virtualenv, and is the suggested method for installing Pyramid. developement.ini Both development.ini and production.ini files are supplied. Not using any template system, since UI developed using EXTJS You can use Response objects to emit raw html created from your controllers. Reason to this change is, Pylons stopped further support for TG2. TG2 was based on Pylons, but, Pylons is still available, but, not very active anymore. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: pyramid_rpc
On Jan 31, 1:03 am, binadam ibnad...@gmail.com wrote: Does pyramid_rpc.jsonrpc only accept 2.0 requests? when i use android- json-rpc client to make rpc call i get JsonRpcRequestInvalid exception, so I'm guessing android client is sending v1.0 requests (must admit I don't know difference between versions 1.0 and 2.0) There is http://code.google.com/p/android-json-rpc/ which does handle 2.0, but, I suspect the library you're using is probably not sending the rpc_version, rather than it being 1.0. json-rpc 1.0 doesn't support named parameters and only supported positional parameters, so, you would pass something like: params: [asdf, qwer, , , , username] json-rpc 2.0 would look like: params: {name:asdf, company:qwer, login:username} As you might imagine, that alone is going to be quite a showstopper. If commenting out that check worked, you're probably using json-rpc 2.0 and should be pretty safe and I suspect that is the main reason pyramid_rpc forces json-rpc 2.0. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: pyramid_rpc
On Feb 1, 6:18 pm, binadam ibnad...@gmail.com wrote: Looks like android-json-rpc is doing v1.0 as seen below: {id:1,method:search,params: [34.0149334,-118.2710851,100,-50,50]} json-rpc 2.0 supports both named positional parameters which is why I'm guessing it worked after bypassing the version check. I knew 2.0 supported positional parameters, but, I wasn't sure whether pyramid_rpc was declining 1.0 because pyramid_rpc didn't handle positional parameters. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: any advantages of using fast cgi over reverce proxy with nginx?
You could use uwsgi (http://projects.unbit.it/uwsgi/) which I think is a lot better than using fastcgi. However, if fastcgi/reverse proxy are your only choices, I think I would choose paster with a reverse proxy. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Maintenance Debugging after deployment
On Jan 6, 6:02 am, Ahmed ahmedba...@gmail.com wrote: git push web for deploying .. really cool), but was wondering if I will ever have to do a debug on the production machine itself in a case of a bug?? Can I do another wsgi script but using the Take a look at pyramid_exclog. It will mail any exception generated to you so that you can have production.ini using that, and development.ini set to use weberror or whatever debugging system you use. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: SQLAHelper 1.0 released, and a proposal
For reference: Github: https://github.com/Pylons/SQLAHelper Docs: http://readthedocs.org/docs/sqlahelper/en/latest/index.html -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: wsgi servers...
On Dec 24, 7:13 pm, Iain Duncan iainduncanli...@gmail.com wrote: Are you going to give us one for xmas? ;-) https://github.com/mcdonc/waitress Evidently... :) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: wsgi servers...
pure python: aspen, cherry py, magnum-py, tornado, gevent, rocket, wsgiref Twisted might fall outside pure python - also probably a very large dependency. aspen doesn't support python 3 that I know of. Magnum-py doesn't support python 3. Tornado does support python3.2, but, I believe there were some 3.2 bugs last time I looked. I recall seeing someone mentioning gevent/libevent-http with python 3 compatibility, but, not officially supported. I did see someone had ported pieces of Twisted to 3.2, but, I don't believe there is anything official. To my knowledge, even though Tornado supports python3.2, I don't believe it supports PEP 100% due to some string handling issues and there were bugs filed for it when I last looked in October. I've not used rocket, but, I believe it wraps wsgiref. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Odd error from WebOb if you set a cookie value to be an Int and not a String
opening 1 might have gotten stdout which is the only thing I can think would give that sort of an error. Why it would open a file for a cookie value I don't know, but, that would be my first guess without digging into the code. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: deform / colander req. for maintainer
On Dec 7, 12:25 pm, John Anderson son...@gmail.com wrote: still do code reviews if I ping you when I finish the pull requests? I have the time and willing to help out with both projects since I'm Your code is about the cleanest I've seen in quite some time. I don't think you'll get too much rejection from above. :) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: how can i access config settings in my pyramid app handlers/templates ?
If you're using pyramid_handlers as a pylons convertee, remember that it would be self.request.registry.settings -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Strange paster serve behavior
:!strace paster serve development.ini This will print a lot of debug info, but, if it hangs, you should be able to see where it pauses. Maybe even prepend with script or append 2/logfile until you get a trace that breaks. (I can't recall if strace writes to stdout or stderr, if stderr, the 2 redirect would work, if not, you would need to run typescript) If it doesn't happen frequently, it might be difficult. What I've found strange at times is that paster appears to actually scan the filesystem which requires Time Machine's drive to spin up as it is a local resource). Once in a while while opening a tab when Chrome does autocompletion that matches something where I've done a //file/ asdfsadf, it'll do the same. Alternatively, Command-T, cd /into/your/virtualenv, source bin/ activate paster serve --reload development.ini :) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Usability is the most biggest problem of Pylons Pyramid.
http://highscalability.com/ has a number of case studies as does http://www.allthingsdistributed.com/ and are pretty good references. As for a consolidated FAQ, there are so many variables, there is never a best for every solution. In every case, you have to know what your stumbling blocks are in order to fix them. And you can't just look at the benchmark of the day because many are not run properly or aren't anywhere near testing real world situations. For one project I'm working on, I thought my use case was rather specific. After evaluating nine potential solutions and implementing two test projects in two separate long polling/ajax push scenarios, I realized that my initial design wouldn't work and that none of the solutions were optimal for what I needed. So, I had to pull the decision making back a layer and then I could implement almost any long polling solution - each worked as long as I had the ability to access named pipes. The battles with noSQL versus SQL are almost as religious as which noSQL solution is best. Do you need streaming map/reduce? do you care about immediate or eventual consistency? Every decision brings a dozen solutions and each solution needs to be evaluated. There are people that will pick their favorites and become experts in those and in 90% of the cases, you can usually shoehorn an idea into the tools in your skillset. The fundamental differences between riak, mongodb, couchdb, cassandra, etc. are there, but, it would be hard to say that any of them couldn't be engineered to handle most of the nosql use cases. While it would be nice to say, a + b + c + d = fastest, you need to qualify that as 'fastest in this situation'. Welcome to the world of scaling. :) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: How to pass variables to HTTPFound?
http://docs.pylonsproject.org/projects/pyramid/en/latest/api/request.html#pyramid.request.Request.route_url covers the various options for HTTPFound and route_url route_url('submit', self.request, _query=values) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Python UTF-8 defaults, Paster and Pyramid/mod_wsgi
When pushing an app to production today, I was hit with: TypeError: expected byte string object for header value, value of type unicode found Of course, the reason was that I was adding headers to the HTTPFound headers = [] headers.append( (str('P3P'), str('CP=IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT')) ) but, hadn't wrapped them with str(). Now that Python defaults to unicode for strings, WSGI is going to break unless a string is explicitly set to a string rather than the default unicode. a simple mapper in Pyramid would fix this, but, I'm reluctant to commit that as it is a hack which still hides the problem, and, could break things later on. Thoughts? or document and let everyone figure it out on their own? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Deform, CheckboxChoiceWidget, default values set in appstruct
@colander.deferred def deferred_labels_widget(node, kw): list = kw.get('list', []) return deform.widget.CheckboxChoiceWidget(values=list) class LabelSchema(colander.Schema): link_id = colander.SchemaNode( deform.Set(), title='Select items to print', widget = deferred_labels_widget, ) def labels(request): defaults = {} uid = authenticated_userid(request) links = DBSession.query(Link).filter(Link.user_id==uid).all() list = [(unicode(link.id), link.name) for link in links] defaults['link_id'] = ((u'1','checked'),(u'13','checked')) #defaults['link_id'] = ((u'1','checked')) defaults['num_to_print'] = '2' defaults['label'] = '5163' return {'form':form.render(appstruct=defaults)} If I use defaults['link_id'] = ((u'1','checked')) The first entry is indeed prechecked If I use: defaults['link_id'] = ((u'1','checked'),(u'13','checked')) neither is checked. I'm a little confused at what chameleon should be checking here: input tal:attributes=checked value in cstruct; but, value and cstruct appear to be valid (value - cstruct is printed below): 1 - ((u'1', 'checked'), (u'13', 'checked')) If I try in the python shell what I believe chameleon is doing, it does appear to work. a=((u'1', 'checked'), (u'13', 'checked')) ('1','checked') in a True ('13','checked') in a True ('14','checked') in a False Changing the order of the arguments to (('checked',u'1')) does work, but, adding the second entry makes both fail as well. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: MySQL has gone away errors - any tips?
On Nov 2, 3:40 pm, Stefano Fontanelli s.fontane...@asidev.com wrote: Il 02/11/11 18.54, Benjamin Sims ha scritto: My ini file contains: sqlalchemy.pool_recycle = 30 Hi Benjamin, did you try to increase pool_recycle? In our applications we use 'sqlalchemy.pool_recycle = 3600' When you get that error, it means that pool_recycle is mysql's idle timeout - increasing the timeout will increase the possibility that this will happen. The first question to address this is, are you connecting via socket or tcp? because you MIGHT be hitting a TCP timeout rather than a mysql idle timeout. If so, you need to fix that from the TCP side. Most operating systems will default to 600 seconds, however, your pool_recycle time of 30 seconds should be well under that. One possibility is to reduce pool_recycle to 10, or, turn echo_pool on in your debugs to see what is happening. With pools, it is possible that you have an idle pool that is being hit that has timed out. If it persists, you could import NullPool and set poolclass=NullPool, however, that might introduce threading/concurrency issues on a busy system. I've run pool_recycle at 10 to eliminate that problem, but, I connect via sockets rather than tcp on most machines. Also, you might check wait_timeout= to see if that value is set too low. I don't recall if sqlalchemy uses CLIENT_INTERACTIVE or not - I don't believe it does, which means interactive_timeout= isn't the variable to set. I don't see that it sends CLIENT_INTERACTIVE to MySQLdb, so, you might check wait_timeout to see if it is set too low. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Translation
On Nov 4, 8:03 pm, Bruce Wade bruce.w...@gmail.com wrote: We are trying to use translation when generating a PDF file from a request. However for some reason the locale for the string is extracted from the file however when generating the PDF it never translates. Any suggestions on how to translate for reportlab using pyramid? when using canvas.textLines(_('translated text')), you're saying reportlab is ignoring it? I just tested v2.5 and a quick test worked for me. There are some characters that may not render based on the font you've chosen. Can you supply some sample code that doesn't work? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Intermittent encoding error after moving to Apache
On Oct 28, 6:27 am, Benjamin Sims benjamins...@gmail.com wrote: sqlalchemy.pool_recycle = 3600 Your pool_recycle needs to be less than /etc/mysql/my.cnf:interactive_timeout= That typically fixes that. I actually run with pool_recycle=60 and I've not seen that error since. As for your UTF error: [Fri Oct 28 02:03:28 2011] [error] [client 217.46.198.185] UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 467: unexpected code byte, referer: http://example.org/app_dir/stream/all/1 $ python (should occur across 2.[456] as well) Python 2.7.2+ (default, Aug 16 2011, 07:03:08) [GCC 4.6.1] on linux2 Type help, copyright, credits or license for more information. '\x92'.decode('utf-8') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.7/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 0: invalid start byte Are you sending binary data that shouldn't be processed? Do you have an event or subscriber processing output? is it trying to use a template? You might need return Response rather than running that through your template engine if that is the case. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Intermittent encoding error after moving to Apache
On Oct 28, 8:32 am, Benjamin Sims benjamins...@gmail.com wrote: - I'm not sending any binary data that I'm aware of; page content is text from the MySQL database. Sometimes this error even occurs on my login page, which does very little other than display a welcome and a form - There are no events of subscribers As I mentioned, this did not occur with paster and is intermittent (which made me wonder if it is related to the MySQL thing). I'm at the point where I'm considering giving Nginx a go just to see if it is more stable, or perhaps going through the rather tricky process to get interactive debugging going on Apache (http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Inte... ) Paster sometimes handles things that violate standards silently, while Apache will complain. If it happens on a login page, I am wondering if it is a header that is being set. Any custom headers or cookies being set? Do you have i18n set up? I don't use Chameleon, but, is your template properly formed, i.e. has the right encoding, proper namespace declaration, etc? Chameleon tries to detect the encoding based on the body and is very strict about the page being properly formed. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Intermittent encoding error after moving to Apache
On Oct 28, 10:00 am, Benjamin Sims benjamins...@gmail.com wrote: It does sometimes occur on the login page, but also on other pages. It will fail a few times, then start working for a bit and continue that way. I'm wondering if you ran the app under paster, ran a bunch of wget -S on a small page, typescript so that you capture the output, then, ran the same under apache/mod_wsgi. Another thing to do, modify the code in chameleon right before the return to print the body and encoding. Possibly it is getting a value that it isn't expecting? Write to a file so that you know the last file contains precisely what is failing, or, wrap it with a try/except to write the body when it does fail. Since it happens on the login page, unless you're touching the database here, I suspect it is either an odd translation (which would not really happen intermittently) or some odd session variable that isn't being encoded. Position 467 seems far enough that it might not be in the header, but, that would depend on any cookies that are being set. Perhaps a user defined meta tag or some other replacement occurring in your template? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons, Apache reverse proxy/virtual hosting domain names
Some providers will set up wildcard hostnames, i.e. *IN A 1.2.3.4 whereanything.domain.com will be resolved to the name. What it looks like based on the check is that the ONLY thing set up currently is domain.com. At a minimum, you would need to define A records (or CNAME records to point to domain.com) for each hostname, or, if they support wildcard DNS, set that up. Usually when a domain is created, domain.com and www.domain.com are set up, but, that doesn't appear to be the case with what you've presented. So, your DNS provider is the one that can fix this. If you have it hosted at almost any registrar that offers DNS, you can usually set this up through the Domain Registrar's control panel. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons, Apache reverse proxy/virtual hosting domain names
Host not found usually means that you have a DNS issue, so, www.mydomain.com is not being resolved to anything. Your apache config looks fine, getting the hostname to resolve to the IP should fix your problem. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Handling Sign In Error and Creating Log in Pyramid
Within Pyramid, this doesn't exist. Auth is set up by the author, but, the permissions and ACLs are built into Pyramid. You would have to write your own routines to do this. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: how to exclude some views from csrf checking
http://thesoftwarestudio.com/apex/options.html apex.no_csrf = OPTIONAL, a colon separated list of route names that should NOT be subject to CSRF tests. After a bit of back and forth with Pyramid and the way the event fires off, a decorator with the current CSRF check won't work. I've got to dig deeper into Pyramid to find an alternate, more correct solution. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: how to exclude some views from csrf checking
On Sep 26, 1:58 pm, Michael Merickel mmeri...@gmail.com wrote: Likely you will need to add some code to the csrf_validation function to exclude the RPC URL. For example: def csrf_validation(event): CSRF token exposed to templates request = event.request if request.matched_route.name != 'MYRPCROUTENAME' and request.method == 'POST': What version of pyramid supports matched_route? I've tested a few versions, even 1.2.1, but, it always returns None (if specified with .name, I get AttributeError: 'NoneType' object has no attribute 'name'). Is this in a development version, if so, when will that be released? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: how to exclude some views from csrf checking
On Sep 24, 7:29 am, Viktor Nagy viktor.n...@toolpart.hu wrote: I'm building a site that uses apex for site-wide auth functionalities, and would like to use pyramid_rpc for amf gatewaying. But apex adds csrf checking for every POST request. I've entered this on the issues and will have a suitable fix in the next day or two for this. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: SQLalchemy issue when extending Pyramid application
On Sep 11, 4:27 am, AwaisMuzaffar awais1...@googlemail.com wrote: On Sep 11, 12:18 am, cd34 mcd...@gmail.com wrote: On Sep 10, 4:55 pm, AwaisMuzaffar awais1...@googlemail.com wrote: I have a Main Application, and in this application I have the following in the _init_.py file: def main(global_config, **settings): # various config settings config.include(site_configs) def site_configs(config): config.add_route('portfolio', '/portfolio', view='mainapp.views.portfolio', view_renderer='/site/portfolio.mako') Load order and SQLAlchemy (actually, almost anything based on settings) has some unique issues. in your includeme: initialize_sql(engine_from_config(settings, 'sqlalchemy.'), settings) Then, in your model file: def initialize_sql(engine, settings): By passing settings, you can use the config object that is already created. Thanks cd34 for your reply, would I do this in the main application. def includeme(config): initialize_sql(engine_from_config(settings, 'sqlalchemy.'), settings) Also why does: 'from mainapp.models import initialize_sql in the new applications __init__.py file resolve the issue. (I am importing initialize_sql from the main application) and would that be the right way of doing things. It depends on where you want to manage the load order issue. If you are developing a Pyramid extension, you need to pass settings inside your def includeme. If you are just writing an application and aren't intending on distributing it, you can import from the main application and accomplish the same thing. Either is probably correct, but, if you are using includeme and intend to write your application to be 'pluggable', then you may want to pass settings so that you can more easily reuse your included app. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: SQLalchemy issue when extending Pyramid application
On Sep 10, 4:55 pm, AwaisMuzaffar awais1...@googlemail.com wrote: Hi, I have a Main Application, and in this application I have the following in the _init_.py file: def main(global_config, **settings): # various config settings config.include(site_configs) def site_configs(config): config.add_route('portfolio', '/portfolio', view='mainapp.views.portfolio', view_renderer='/site/portfolio.mako') Load order and SQLAlchemy (actually, almost anything based on settings) has some unique issues. in your includeme: initialize_sql(engine_from_config(settings, 'sqlalchemy.'), settings) Then, in your model file: def initialize_sql(engine, settings): By passing settings, you can use the config object that is already created. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Webhelpers html tag examples
On Sep 8, 7:44 am, Ben Sizer kylo...@gmail.com wrote: So, again (not directed to you, Chris): are there any examples of people using the webhelpers.html.tag stuff with Pyramid? :) http://groups.google.com/group/pylons-discuss/msg/d711428e505072b5 This enables webhelpers in a very minimal project. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Have to log out twice?
Haven't seen that behavior, however, IE and Safari seem to have intermittent issues: headers.append( ('P3P', 'CP=IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT') ) resolves most of them. Can you run LiveHeaders in firefox and see if it is actually resetting the cookie when you log out the first time? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Composite application configuration
paster uses pipelines to do that [app:app1] use = egg:app1 [app:app2] use = egg:app2 [composite:main] use = egg:Paste#urlmap / = app1 /app2 = app2 If you need to use exceptions, you can do something like: [pipeline:pipeapp2] pipeline = exc tm app2 and in your composite:main /app2 = pipeapp2 composite is the section you need to read in the docs to understand it more fully. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Composite application configuration
can you use [DEFAULT]? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid addons that are not part of the pyramid project
As far as Trove classifiers go, they do not affect google, github, bitbucket, sourceforge or code.google searches. What does affect github is quite interesting and they put weight in areas I wouldn't have expected. However, if someone is looking for extensions or addons to pyramid after page two or three, the results become wildly inaccurate and do skip over projects that you would only find if you knew it existed. As for using pypi for search, I would bet that a large percentage of the new adopters looking for code to support Pyramid probably aren't using pypi as their search resource. And there are a few projects that use pyramid that don't have the proper trove classifiers, so, you still miss packages. Because of the way the repositories do word stemming, pyramidext would have the same problem you have right now. But, point taken. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid addons that are not part of the pyramid project
As far as Trove classifiers go, they do not affect google, github, bitbucket, sourceforge or code.google searches. What does affect github is quite interesting and they put weight in areas I wouldn't have expected. However, if someone is looking for extensions or addons to pyramid after page two or three, the results become wildly inaccurate and do skip over projects that you would only find if you knew it existed. As for using pypi for search, I would bet that a large percentage of the new adopters looking for code to support Pyramid probably aren't using pypi as their search resource. And there are a few projects that use pyramid that don't have the proper trove classifiers, so, you still miss packages. Because of the way the repositories do word stemming, pyramidext would have the same problem you have right now. But, point taken. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid addons that are not part of the pyramid project
As far as Trove classifiers go, they do not affect google, github, bitbucket, sourceforge or code.google searches. What does affect github is quite interesting and they put weight in areas I wouldn't have expected. However, if someone is looking for extensions or addons to pyramid after page two or three, the results become wildly inaccurate and do skip over projects that you would only find if you knew it existed. As for using pypi for search, I would bet that a large percentage of the new adopters looking for code to support Pyramid probably aren't using pypi as their search resource. And there are a few projects that use pyramid that don't have the proper trove classifiers, so, you still miss packages. Because of the way the repositories do word stemming, pyramidext would have the same problem you have right now. But, point taken. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Webhelpers html tag examples
virtualenv --no-site-packages newenv source bin/activate paster create -t pyramid_routesalchemy webhelp cd webhelp/webhelp edit webhelp/development.ini and put near the top: mako.directories = webhelp:templates edit webhelp/webhelp/__init__.py and put: config.add_subscriber('webhelp.subscribers.add_renderer_globals', 'pyramid.events.BeforeRender') config.add_route('webhelper', '/webhelper') config.scan() above: return config.make_wsgi_app() edit webhelp/webhelp/views.py, add: from pyramid.view import view_config @view_config(route_name='webhelper', renderer='webhelper.mako') def webhelper(request): return {'data':'data', 'email1_count':1, 'email2_count':2} create webhelp/webhelp/subscribers.py: from pyramid.threadlocal import get_current_request from pyramid.exceptions import ConfigurationError from pyramid.url import route_url from webhelp import helpers def add_renderer_globals(event): request = event.get('request') if request is None: request = get_current_request() globs = { 'h':helpers, } event.update(globs) create webhelp/webhelp/helpers.py: from webhelpers.text import plural from webhelpers.html.tags import form create webhelp/webhelp/templates/webhelper.mako: p here's my ${data} /p You have ${h.plural(email1_count,'message','messages')}.br/ You have ${h.plural(email2_count,'message','messages')}.br/ ${h.form('asdf')} Briefly, any import in helpers will be exposed to your template as h.whatever. If you just want to use normal webhelper rather than a form library you can. Also, I use deform with both Mako and Jinja2, and unless you need to change the widgets, it doesn't really matter much that the templates use chameleon. I've written several projects and except for one minor case, haven't modified the templates. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Webhelpers html tag examples
Mike Bayer (of Mako and SQLAlchemy) posted this: http://techspot.zzzeek.org/2008/07/01/better-form-generation-with-mako-and-pylons/ While it discusses Pylons, it does address one possible method without using a form library (or, using Mako as a form library). The method isn't limited to Mako, you could do it with Jinja2 or any other reasonably powerful templating language. I like deform - it has some very sophisticated widgets that make developing some rather complex forms easy. The only issue I have (coming from an SQLAlchemy background and not a zodb background) is that it requires some magic to bring appstruct over to an object that SQLAlchemy can use. http://cd34.com/blog/framework/using-pyramid-with-deform-to-editcreate-records-in-sqlalchemy-backed-database/ WTForms is very Djangolike and works pretty well. We used it as the form library for Apex. Formalchemy's documentation is in a state of flux. They swapped maintainers moved the site, some of the links 404. If you are looking for a form library that is very well tied to your SQLAlchemy model schemas and has a RESTful interface, it works pretty well. If you're just looking to use webhelpers in your existing forms, you would add it to your subscribers: something like: project/lib/subscribers.py: from pyramid.threadlocal import get_current_request from project.lib import helpers def add_renderer_globals(event): request = event.get('request') if request is None: request = get_current_request() globs = { 'h':helpers, } event.update(globs) project/lib/helpers.py: from webhelpers.text import plural from webhelpers.date import distance_of_time_in_words from webhelpers.date import time_ago_in_words project/__init__.py: config.add_subscriber('project.lib.subscribers.add_renderer_globals', 'pyramid.events.BeforeRender') In your template (Jinja example, Mako would use ${ } rather than {{ }}: br /span id=p-{{data.id}}{{h.plural(data.points, 'point', 'points')}}/span by a href=/user/ {{data.author.username}}{{data.author.username}}/a {{h.distance_of_time_in_words(data.posted_date, granularity='hour')}} ago | a href=/news/{{data.id}}/ {{data.slug}}{{h.plural(data.comment_count, 'Comment', 'Comments')}} /a -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Pyramid addons that are not part of the pyramid project
While developing applications that run on top of Pyramid, having other people find those projects becomes difficult without having pyramid somewhere in the project name. If someone searches github or any of the other repositories, the search function is somewhat inadequate in finding projects without Pyramid in the proper name. Projects have no way to easily signify that they are an addon, yet, are not part of the project. What I would suggest is a naming convention for pypi packages that are related to pyramid, but, not endorsed. Perhaps something like pyramid_ext_ or pyramid_app_. Django applications use the django. prefix and there is little confusion as it is the expected naming convention. I feel that the name Pyramid needs to be in the name somewhere so people looking for apps and extensions that work with pyramid are easily found. It is a two way street - it makes it easier for projects using Pyramid to be found, and, having projects with the Pyramid name in it will validate the framework as having activity and an external development community supporting it. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Webhelpers html tag examples
On Aug 30, 12:22 pm, Ben Sizer kylo...@gmail.com wrote: On Aug 30, 5:08 pm, cd34 mcd...@gmail.com wrote: If you're just looking to use webhelpers in your existing forms, you would add it to your subscribers: something like: project/lib/subscribers.py: You would create that file in the lib directory (if you desired) and reference it in your __init__.py. Where the file is actually located is a matter of personal preference. You could create subscribers.py in your project directory and adjust the config.add_subscribers line you added to your __init__.py as needed. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Webhelpers html tag examples
On Aug 30, 12:36 pm, Ben Sizer kylo...@gmail.com wrote: On Aug 30, 2:42 pm, Benjamin Sims benjamins...@gmail.com wrote: The demo site provides nice examples of its capabilities: http://deformdemo.repoze.org/ Having explored this a little more, I must admit I find it daunting. Sure, for simple stuff it's easier than building HTML by hand, but for anything non-trivial, it's hard to work out what to do, because everything's hidden from me. I have an object which is a few string fields and then a list of references to Tag objects. The input for the rest of the object is fine but I can't see any way to handle the tags, because the way the schema seems to work is that it assumes the object is composed of everything within it, as opposed to associating with things outside of it. So I can add new tags to the object, but that is not the behaviour I want, because the user needs to be limited to existing tags. What you want is to use the deferred decorator and then pass your values along using .bind() http://deformdemo.repoze.org/deferred_schema_bindings/ Something like this using def deferred_csrf_token(node, kw): csrf_token = kw.get('csrf_token') return csrf_token class UserSchema(colander.Schema): csrf_token = colander.SchemaNode( colander.String(), widget = deform.widget.HiddenWidget(), default = deferred_csrf_token, ) name = colander.SchemaNode( colander.String(), widget = deform.widget.TextInputWidget(size=80), missing=u'', ) phone = colander.SchemaNode( colander.String(), widget = deform.widget.TextInputWidget(size=80), missing=u'', ) @view_config(route_name='profile_index', renderer='profile_index.jinja2', permission='authenticated') def index(request): schema = UserSchema().bind(csrf_token=request.session.get_csrf_token()) form = deform.Form(schema, buttons=('Update Profile',)) return {'form':form.render()} something closer to what you might want: @colander.deferred def deferred_users_widget(node, kw): users = kw.get('user_list', []) return deform.widget.SelectWidget(values=users) class FormSchema(colander.Schema): label = colander.SchemaNode(colander.String(), title='or', missing=u'', widget = LabelWidget(), ) user_id = colander.SchemaNode(colander.String(), title='Username', widget = deferred_users_widget, ) In your view: schema = HtaccessSchema().bind(user_list=get_ftpusers(self.uid)) form = deform.Form(schema, buttons=('Update',)) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid addons that are not part of the pyramid project
pyramid_registration does pretty much what Apex does - or appears that it will. Apex is just auth + registration on top of pyramid. CSRF and Flash messages were added into it because CSRF should be included in any front-facing webapp and Flash messages just made it easier to communicate events with a user when they signed in, registered or their password was invalid. Supporting i18n should be done for any app developed in the 21st century. Same with Pyramid_openid - which is just authentication with Pyramid using OAuth2 as a provider. At what point does a toolkit become an application? You can't do anything with Apex except auth and registration. You can't deploy Apex as an application - the app would do nothing but allow someone to register and sign in. This is similar to Akhet which is a layer on Pyramid to give developers a more pylons-like environment. Kotti does have CMS features and by definition appears to be an application or framework that uses Pyramid as a base which would be ineligible. I imagine someone new to Pyramid may not find Kotti, or, may not make the association that it has quite a few CMS components available and ready for a Pyramid app. While you may not want to endorse external apps or show preferences, I think it benefits the communities on either side. I'm not really that concerned about it for Apex, but, having an easy to find set of extensions and apps should raise awareness for pyramid - if that is a goal. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Applying changes to the database schema – SQLAlchemy
You might want to take a look at http://code.google.com/p/sqlalchemy-migrate/ which does a pretty good job handling schema transitions like that. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid 1.2a1 released
Word of note: config.commit() config.include('packagename') config.scan() If scan is executed prior to include, and your include modifies the root factory or authnauth, auth won't actually work. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
testing with DummyRequest() when view requires access to cookies
When testing with DummyRequest, HTTP_HOST and SERVER_NAME aren't set. As a result, one of two things needs to happen: pyramid/authentication.py (line 377) cur_domain = environ.get('HTTP_HOST', environ.get('SERVER_NAME')) If cur_domain doesn't find either HTTP_HOST or SERVER_NAME, cur_domain is set to None which causes a TypeError: /pyramid/authentication.py, line 388, in _get_cookies if ':' in cur_domain: TypeError: argument of type 'NoneType' is not iterable One possible workaround in the test code is to set the environment locally: environ = { 'HTTP_HOST':'test.com', 'SERVER_NAME':'test.com', } request = testing.DummyRequest(environ=environ) However, should testing.setUp set certain variables to a sane default, perhaps 'localhost' unless overridden? pyramid.paster.bootstrap seems to properly handle this, but, the pyramid.testing doesn't. Perhaps a more forgiving default could be used to avoid the exception? The TypeError as it is could point out incorrectly configured deployments whereas a default of localhost might cause additional trouble debugging deployment issues. Or, should the test setUp set a bare minimum environment and more closely replicate bootstrap's behavior? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Removing *.fcgi from URL on redirect's
In wsgi, that url is built from the environment parameter SCRIPT_NAME. I haven't used flup, but, I would guess it might be the same. I don't believe pyramid uses SCRIPT_NAME, but, paster.resolve prepends it when talking with Pyramid. You might try something like: SCRIPT_NAME= export SCRIPT_NAME in your wrapper, or in your constructor: os.environ['SCRIPT_NAME'] = ''; This is probably not a great thing to do, but, Apache's the rewritten url to generate SCRIPT_NAME and PATH_INFO to build the REQUEST_URI, and the behavior you want is to remove SCRIPT_NAME when REQUEST_URI is passed to the backend. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Looking for python/pyramid developers for a project
On Aug 19, 3:08 pm, Dirk Makowski dirk.makow...@googlemail.com wrote: I am Dirk, and am interested in your offer. Unfortunately your email address is not fully disclosed (mzu...@gmail.com). If you view the post on google groups: http://groups.google.com/group/pylons-discuss/browse_thread/thread/92475f27a1f75df2 you can click on the ... in the email address, enter a captcha, and get the email address. I don't recall if you have to be a member of the group for that to work or not. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: is it possible to use virtual environment with pylons without activation?
you can do: #!/path/to/virtualenv/bin/python in your startup script which will cause the script to load from that environment. Cron jobs are often run this way. At that point, you might also choose to update your environment: import os, sys, site sys.path.append('/path/to/pyramid/project') site.addsitedir('/path/to/pyramid/lib/python2.6/site-packages') -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: using the authentication framework and pyramid_apex
permission='users') should fix that. The way the root factory is currently set up in the Pyramid docs, a short method is used. I debated whether to mimic pyramid's current config, or whether to set permissions using more verbose names as you tried. class RootFactory(object): __acl__ = [ (Allow, Authenticated, 'authenticated'), (Allow, 'group:user', 'user'), (Allow, 'group:admin', 'admin') ] This is the default ACL - the permission equivalency check takes place on the last field in each tuple. I'll include a better example in the docs. Thanks for trying it out. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid: what is the proper way to present a login form when user is not logged in using handlers?
You can also do something like: config.add_view(forbidden, context=Forbidden) def forbidden(request): flash(_('Not logged in, please log in'), 'error') return HTTPFound(location='%s?came_from=%s' % (route_url('login', request), current_route_url(request))) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Deform autocomplete tag sequence widgets?
About the best resource to check there would be: http://deformdemo.repoze.org/ -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: openid with pyramid
On Jul 23, 1:13 pm, Viktor Nagy viktor.n...@toolpart.hu wrote: The test server is called from /login, and it tries to get back to my page, but it gets redirected again and again to itself as incoming_openid_url is set when the verify_openid method gets called. The redirect is due to the fact that openid=url is passed through and not stripped: https://github.com/cd34/pyramid_openid/commit/1e1ebbf88c814cc861857f5576ab7b1464832d4d Are there other packages providing openid consumer functionality? Or could someone point me to a nice tutorial for pyramid_openid, please? If you need integration for something more than just openid: http://pieceofpy.com/blog/2011/07/24/pyramid-and-velruse-for-google-authentication/ shows you the basics for integrating pyramid with Velruse which handles a number of providers. https://github.com/cd34/pyramid_apex is a package Matthew Housden and I are putting together for our needs which includes a bit more than just auth. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: pyramid - how to debug on production server?
How are you calling your .wsgi script? ScriptAlias / /path/to/script.wsgi or using mod_rewrite? What does the apache error log say that corresponds to the 404? mod_wsgi is pretty helpful with debugging messages. with mod_wsgi, you can touch the .wsgi file to get it to reload, or restart apache. Most daemon methods do that since they cache the code to avoid the startup penalty, which, makes it a bit more difficult to develop your application the way it'll be deployed. If you're doing development, I prefer using paster serve --reload development.ini which reloads each time it recognizes a file has been changed. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: issue to deploy pylons application under mod_wsgi
application = ErrorMiddleware(application, debug=True) That line is sure to cause problems. Debugging Middleware usually causes issues with mod_wsgi because unless you run a very specific configuration to eliminate multi-threaded requests, though, the error you're getting is that application isn't properly being passed to your ErrorMiddleware. I think you also need to remove the stanza in development.ini that refers to WebError. Check your apache error log, it might tell you what mod_wsgi is encountering as well. http://code.google.com/p/modwsgi/wiki/DebuggingTechniques -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid #twitter #tag
The convention that I've noticed is #pylons or #pylons #pyramid. However, right now with the debate over the power pylons in the UK, that hashtag has been quite inundated. Once in a while you will see a starcraft pylons reference. It would be helpful to use a standardized one like #pyramid1 that would cut down on the clutter, but, since it is a Pylons project, #pylons isn't overly busy. It does beat following #varnish and learning all sorts of manicure and nailcare tips. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: IE7 displays Internet Explorer cannot display the webpage on simple pylons application
Will see if I can test this later, but, first thing that stands out (might be a cut and paste thing) input type=hidden id=foo7 name=fooname7 value=somevaluevalue7/ input type=hidden id=foo8 name=fooname8 value=somevaluevalue8/ input type=hidden id=foo9 name=fooname9 value=somevaluevalue9/ your first fields are missing the closing , which can cause versions of IE to not render a form properly - are you even seeing the POST on the server side when the button is hit? If not, I would suspect that broken html. If the html is indeed correct and it was a cut and paste error, offhand I'm not sure. Are you running the same versions of software between the two? can you post easy_install.pth from your site-packages directory from both installations? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: IE7 displays Internet Explorer cannot display the webpage on simple pylons application
I can't duplicate it, though, only have IE8 here. If you remove half of your hidden fields does it work? Is it related to the number of hidden fields? or just the fact that there are 100. I remember an issue with IE where id=name name=name used to be an issue, but, you're not doing that. This is being served from paster? or through apache/nginx/something else? The other thing that IE used to do, if you do a post to www., but were served the content from domain.com - but, based on your code, you're using a relative link. If you were behind apache, perhaps mod_rewrite is rewriting based on hostname, and tossing the request? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: simple example using repoze.who for authorization in pylons-app
http://cd34.com/blog/framework/repoze-whorepoze-what-with-pylons-step-by-step/ wrote this a while back -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: simple example using repoze.who for authorization in pylons-app
On May 4, 12:18 pm, Rob Miller r...@kalistra.com wrote: On 05/04/2011 07:30 AM, cd34 wrote: http://cd34.com/blog/framework/repoze-whorepoze-what-with-pylons-step... Speaking of which, I gave you mad props for your various Pylons to Pyramid blog posts in the talk on migrating to Pyramid that I gave at the SF MiniCon last week. Thanks for those! Thanks! always good to hear that it was useful to someone. Also, I've written up some thoughts on the MiniCon and posted my slides athttp://blog.nonsequitarian.org/2011/pylons-project-mini-conference/for anyone who's interested. Looks like quite a conference. I've followed quite a few of the other participants as they posted their slides. I'm on the wrong coast. haha -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: session, beaker cookie expiration and remember me
In Pyramid, http://docs.pylonsproject.org/projects/pyramid/1.0/api/security.html#pyramid.security.remember you can specify the expiration length in your handler. In Pylons, it depends on the auth system you're using. Both authkit and repoze.who/what have hooks that can be modified similarly. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Use AuthKit without wsgi?
Authkit hasn't been maintained for quite a while. Repoze.who/what is a little more maintainable, but, what is it about Tornado's auth that doesn't work for you? http://www.tornadoweb.org/documentation#user-authentication I didn't find too many issues with their auth short of it needing some extra functionality for one project, but, overall, it worked pretty well. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Insight for configuring Pylons with repoze.who
What I ended up doing for that project was actually leaving the repoze.who/what tables alone and created a parallel table with my data. That way, my schema changes wouldn't affect auth. On another project I let the AuthUser model alone, but, defined my own definition and set: __table_args__ = {'useexisting':True} allowing one table for auth and metadata without having to modify the default models. Personally, I feel that both approaches are probably incorrect and with Pyramid, I have overloaded AuthUser with my own model so that I only need to do one fetch each time there is an auth request and all extended data is present in the session (with a little modification). While each are probably valid approaches, the indirection of the first two probably would confuse an external developer making modifications or troubleshooting more difficult. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Subdomains in Pyramid / Paste
You could do this with custom view predicates if you wanted a single 'application' where your pyramid app decided how to handle the hostnames: http://plope.com/weird_pyramid_urldispatch But, I've generally divided subdomains by purpose and run separate instances where possible. In your case, I think the custom view predicates probably does what you need. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Insight for configuring Pylons with repoze.who
http://cd34.com/blog/framework/repoze-whorepoze-what-with-pylons-step-by-step/ This is what I did - you're using Pylons, not Pyramid right? If you're using Pyramid, http://cd34.com/blog/framework/converting-pylons-1-0-repoze-whorepoze-what-to-pyramid-1-0a1-authentication-backed-with-mysql/ uses the repoze.who/repoze.who schema that I used for another project. I've actually rewritten almost all of that to use Deform and modified it quite a bit, but, haven't had a chance to document that. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Form handling in Pyramid
FormEncode allows me to build forms right from the schema. At this point, if you need something like a GridTable layout, FormEncode is the only solution I've found. I moved from Formish to Deform and I find Deform to be quite powerful and quite good, though I hate the li form aspect and much prefer a tableform layout like ToscaWidgets had. However, Deform works much better for what I'm working on. I would prefer something a little more tied to the schema, but, writing two quick hooks. I never liked the separate action handlers required for ToscaWidgets and much prefer the single action for create/edit and validate. To use SQLAlchemy, I wrote two quick functions, though, there are some minor issues dealing with datetime objects that I haven't handled. http://cd34.com/blog/framework/using-pyramid-with-deform-to-editcreate-records-in-sqlalchemy-backed-database/ And if you need Formencode validation with Deform, it isn't difficult: http://cd34.com/blog/framework/using-formencode-for-validation-with-colander-and-deform/ -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Many to many, the declarative way...
First thing I see is that you have backrefs to groups but your classname is Group -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pyramid Genshi Template Renderer Configuration
You might take a look at how pyramid_jinja does it. http://docs.pylonshq.com/pyramid/dev/api/configuration.html#pyramid.configuration.Configurator.add_renderer from pyramid_jinja2 import renderer_factory config.add_renderer('.jinja2', renderer_factory) -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: how to use a model (persistence layer) with deform
That code: fn = os.path.join(self.here, attachment['uid']) references here to get the path of the current installation. DemoController subclasses BaseController which subclasses WSGIController, none of which appear to return here as a valid object. from pylons import config fn = os.path.join(config['here'], attachment['uid']) I don't know if older versions of pylons populated the self.here, but, that is probably the issue. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: how to use a model (persistence layer) with deform
deform is a form library that is not tied to your backend storage similar to a few other form libraries. Unlike FormAlchemy that is based almost exclusively on your models, the glue to attach deform to an SQL backend has to be written by you. There are likely some bugs in the url that follows as it was a proof of concept, but, I am using it during development of a production app. While I'm using mysql, sqlite should work fine with some minor schema changes. The one thing I don't recall on sqlite is whether types are sent through properly. If Deform is taking an integer field, your appstruct needs to have the type of the value to also be an integer. http://cd34.com/blog/framework/using-pyramid-with-deform-to-editcreate-records-in-sqlalchemy-backed-database/ -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: strange errors on first hit after restart
Two possibilities. sqlalchemy.echo = false sqlalchemy.echo_pool = false sqlalchemy.pool_recycle = 10 With pyramid, based on a chat in IRC with Ben Bangert, I modified those to: sqlalchemy.echo = false sqlalchemy.echo_pool = false sqlalchemy.pool_recycle = 30 sqlalchemy.pool_size = 20 sqlalchemy.max_overflow = 10 sqlalchemy.pool_timeout = 5 -- However, the thing that is puzzling is the Gone Away/out of sync on startup. I think what you might find there is that you have altered Session somewhere during your startup or not instantiated it properly. Might want to check your models to make sure that the DB session isn't overwritten somewhere which is coincidentally mentioned in a very recent thread: http://groups.google.com/group/pylons-discuss/browse_thread/thread/4994e152af779a38 -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: strange errors on first hit after restart
remember that the docs were wrong in a few places and Mike Bayer/Ben Bangert/Mike Orr(?) fixed the docs/examples/templates a while back. You're running the same stack I run on about 70% of our Pylons apps (and currently 100% of our Pyramid apps) with -p 8 through -p 16 and I've never seen it on startup, and since modifying Pyramid, haven't seen it there with the settings as mentioned above. I only saw the error when a thread was idle for more than the cli timeout. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: strange errors on first hit after restart
is model.meta.py imported somewhere prior to model.__init__.py? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Multiple request in the same controller causing problems with SQLAlchemy Session object
You might try the sqlalchemy list http://groups.google.com/group/sqlalchemy -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: pyramids and pylons
On Nov 6, 1:46 pm, Jeff Tchang jeff.tch...@gmail.com wrote: As a long time user of Pylons the thing that scares me is migration. How much work is it going to take to get my Pylons 9.7/1.0 project to Pyramid. Also since I have projects currently being worked on in Pylons how much of this is going to be dead end work? http://cd34.com/blog/framework/pylons-1-0-to-pyramid-1-0a1/ I had an undeployed Pylons 1.0 project that we had started working on about three weeks ago. We used repoze.who/repoze.what (I do not have Pyramid's auth working with an SQL backend yet) and FormAlchemy along with a number of webhelpers for pagination and constants. It took about 16 hours to convert 35 actions in three controllers to Pyramid. Of that 16 hours, I'd guess that 12 hours was learning Pyramids, reading the documentation, learning how Pyramid did things - I had looked at repoze.bfg in the not too distant past, and getting pointers on IRC to documentation and methodologies behind Pyramid. With that said. Pylons 1.0 isn't going away for a long time. It probably won't see many feature upgrades but will receive bugfixes for stability/security. I don't think I would worry about a project currently using 0.9.7/1.0 being orphaned and unsupported. While Pyramid is tagged as an Alpha release, it is a very mature Alpha. I do believe that we'll be using Pyramid for new development and as we work out some of the pitfalls we run into, I'll post the solutions we find. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Routing question versus real world situation
On Oct 31, 2:14 am, Alexandre Conrad alexandre.con...@gmail.com wrote: I would make sure a site and a subsite is a resource in Routes. RESTful really means that you are using the verbs available in HTTP, that is, GET, POST, UPDATE, DELETE without wasting name spaces like addsite, delsite, etc., in your URL. RESTful doesn't necessarily mean that you must *not* use a query in the URL (like ?site_id=1). So, for your sites, I would have the following CRUD: Create: /admin/site/ (POST) Read: /admin/site/id (GET) Update: /admin/site/id (PUT) Delete: /admin/site/id (DELETE) Meaning that for your subsites, you could have the following CRUD: Create: /admin/subsite (POST) (where parent ID and any other info would be in the POST body) Read: /admin/subsite/id (GET) Update: /admin/subsite/id (PUT) Delete: /admin/subsite/id (DELETE) I looked at this and the same real issue persists with CRUD/Restful. My terminology was wrong - this is for a client facing application where I wanted clean URLs. How does one signify a subsite is being added to a site? The only way I can see it being done is adding another route. With the default routes, /admin/subsite/1 would indicate that you are editing subsite 1, not adding subsite to site 1 It seems no matter what I come up with, I'm having to alter routes to handle things and it just seemed like I was overlooking something. I've got workarounds, but, I was just curious how other people have handled similar situations. Having clean urls just seems nicer, but, I think in this case I am relegated to using ?site_id=1. If I find a better way, I can always rewrite that portion. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Routing question versus real world situation
On Oct 31, 1:44 pm, Alexandre Conrad alexandre.con...@gmail.com wrote: When you create something, like a subsite, you really should want the client (browser, script, ...) to send a POST request. If you intend to create a new subsite with a GET with /admin/subsite?site_id=1 as the path, how would you handle a user hitting multiple times the reload button? You'd create as many subsites as the number of times the reload button was hit and that's probably not what you want. The situation here is that there is a list of 25 sites (paginated). In order to use POST, each 'add site' button would be a form. Adding a site presents a 'new subsite' function that allows them to enter some data before saving, so, a user reloading a page repeatedly isn't going to create multiple sites. By the way, I realize that you said in your original mail that the controller is admin (AdminController). I think that's what might be your problem. You should have a controller per entity, such as site (SiteController) and subsite (SubsiteController). Each having all the necessary CRUD methods (Pylons actions) like paster restcontroller subsite subsites would create for you. You would then just need to add map.resource(site, sites, path_prefix=/admin/) and map.resource(subsite, subsites, path_prefix=/admin/) in routing.py. (I have never played with path_prefix kwarg, so you might want to double check how it behaves). This way you wouldn't need an AdminController at all if all you want to have is the prepending /admin/ path in your URL to make it pretty. I'm leaning towards that. Right now I've got 3 controllers, admin, client and manager. The theory was to keep each of the backend areas in a controller but, I'm finding that layout to be problematic. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Routing question versus real world situation
On Oct 31, 12:53 pm, Marius Gedminas mar...@gedmin.as wrote: On Sun, Oct 31, 2010 at 09:28:10AM -0700, cd34 wrote: It seems no matter what I come up with, I'm having to alter routes to handle things and it just seemed like I was overlooking something. I've got workarounds, but, I was just curious how other people have handled similar situations. Why not use routes like /admin/addsite /admin/site/{site_id} /admin/site/{site_id}/delete /admin/site/{site_id}/addsubsite /admin/site/{site_id}/subsite/{subsite_id} /admin/site/{site_id}/subsite/{subsite_id}/delete I think this is probably the direction I'm going to head. I was actually curious if I was just not understanding how applications were intended to be written around the default routes, or, if adding in routes was the sign of me not understanding the zen of Pylons. Switching from ToscaWidgets to FormAlchemy has also been instrumental in cleaning up urls. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Routing question versus real world situation
On Oct 31, 12:53 pm, Marius Gedminas mar...@gedmin.as wrote: Why not use routes like /admin/addsite /admin/site/{site_id} /admin/site/{site_id}/delete /admin/site/{site_id}/addsubsite /admin/site/{site_id}/subsite/{subsite_id} /admin/site/{site_id}/subsite/{subsite_id}/delete Ended up with: /admin/site /admin/site/{site_id} /admin/site/{site_id}/delete /admin/site/{site_id}/subsite /admin/site/{site_id}/subsite/{subsite_id} /admin/site/{site_id}/subsite/{subsite_id}/delete Modifying routes just made me think I was doing something wrong. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: paging a sqlalchemy query object give a typeError
First, Pylons 1.0 is current, debian is a little bit behind. 0.10 is essentially Pylons 1.0 with deprecation warnings to ease transition from 0.9.x. I use paginate in a number of projects the way you describe using: Pylons 1.0 WebHelpers 1.2 SQLAlchemy 0.6.5 exactly how you describe. Paginate was broken a while back during the transition to Pylons 1.0. Your environment has webhelpers in the wrong place and is loading the wrong version. Debian doesn't install its packages into /usr/local/lib so I'm reasonably sure that is the issue. The question is, how did it get there. If you did an easy- install as root, it might have placed it there, but, cleaning that is probably the first step to diagnosing it. I believe you can edit easy-install.pth in the /usr/local/lib/ python2.6/dist-packages directory and possibly remote the WebHelpers-0.6.4 directory which would remove that library. Make a backup of that directory first just in case. Second, I really would suggest you use a virtual environment for doing pylons development. This way, when you're developing code or multiple projects, you don't have a ton of dependencies installed on your main machine. Projects that you've written that haven't changed can stay on the same version without fear that the API will change when you do an apt-get upgrade. http://pylonshq.com/docs/en/1.0/gettingstarted/#installing contains some basic instructions. or wget http://pylonshq.com/download/1.0/go-pylons.py python go-pylons.py --no-site-packages pylons cd pylons source bin/activate easy_install mysql-python paster create -t pylons project cd project (edit development.ini to alter the IP address, port, sqlalchemy url, etc) paster serve --reload development.ini This creates a subdirectory named pylons whereever you are. Perhaps you want to use /var/www/pylons or /home/username/pylons as the location. When you go back to doing development, you cd /var/www/ pylons, source bin/activate and your environment is modified to run in a sandbox. Whatever you do in that virtual environment doesn't affect the main system. apt-get upgrades don't affect your sandbox either. So, if debian upgrades to a version of software that would break your project, your virtual environment insulates you from the system change. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Routing question versus real world situation
I have an app I'm putting together that has a common UI issue, but, I wasn't sure what the typical pylons method was to handle it. Basically I have: Add Site site Edit | Delete | Add subsite site Edit | Delete | Add subsite subsite site Edit | Delete | Add subsite subsite site Edit | Delete | Add subsite The controller is /admin/ and I have urls of /admin/site to create a new site, /admin/site/id to edit the site and /admin/delsite/id to delete a site. However, I am faced with the situation of adding a subsite to an existing site without some hideous hack. I can't really do /admin/addsubsite/id where id = the parent site id because that would invalidate the ability to later edit that subsite. I'd prefer a restful uri or something without get parameters, but, temporarily I've resorted to ?site_id=1. Any suggestions? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Reusing standalone SQLAlchemy objects in Pylons
On Sep 13, 11:03 am, Kirk Strauser kirk.strau...@gmail.com wrote: from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() Pylons, though, wants those models to inherit from its own base class, like: from myapp.model.meta import Base If you look at the model, /myapp/model/meta.py, you'll find: from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() which is the same declaration you're using. You should be able to use one or the other and utilize the same models for your standalone and Pylons app. I do the same with a few projects, though, in reverse. Pylons models that I use directly in Python with the appropriate from declarations. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons setup problems
Using http://www.pylonshq.com/download/1.0/go-pylons.py python go-pylons.py projectdir cd projectdir source bin/activate paster create -t pylons projectname What version of python are you using? Which step from the above is failing? Can you paste the logs from your terminal session? Are you using a DNS resolver that might be blocking some queries? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Formencode 1.2.2 UnicodeEncodeError
On Sep 2, 1:34 pm, Mike Orr sluggos...@gmail.com wrote: maybe the console is set to ascii, and it found a non-ASCII character in the input. '\x39' is 'é' in Latin-1, which doesn't make sense in an email address. Of course, we don't know the character set, it could be Remember that domains can now have extended characters. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Declarative models, many to many
http://www.sqlalchemy.org/docs/ormtutorial.html#building-a-many-to-many-relationship -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons for Facebook apps
Parts of the REST API are still required and preloading FQL is another issue that needs to be addressed. While decorated actions make sense, I find that I almost have an all or nothing situation with a controller. The one loophole that used to be present with facebook was closed in June eliminating the need for a controller that never asked for privileges. With 2.6, one could just decorate the controller. I think overloading BaseController would provide the simplest integration path. That is the path I took with python-sdk and my latest app. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons for Facebook apps
One thing I seriously debated was whether a single Pylons instance would be used per app, or, whether a single Pylons instance would have multiple controllers, each handling a separate Facebook application. Currently, I have one Nginx with uWsgi (4 threads on a quadcore) that talks to a single Pylons instance. I have three different Facebook applications that utilize the Pylons virtualenv and three separate controllers. While the applications are somewhat interconnected and share the same database, tables are separated with prefixes for the non-interconnected pieces. I do have two other apps, one that uses Apache2/mod_wsgi/Django and one that uses Apache2/mod_wsgi/Pylons. I'm working on another using Nginx/uwsgi and Tornado for a portion. In my case, I felt creating separate virtualenvs outweighed some of the other issues I would run into. Whether my requirements justify a more generic approach, I don't know. As for whether it should be middleware, or a new controller, I think I would like to avoid it being middleware, though, I can see advantages for both. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons for Facebook apps
On Aug 27, 4:00 am, eleith ele...@gmail.com wrote: http://github.com/facebook/python-sdk/ From their web site: This client library is designed to support the Facebook Graph API and the official Facebook JavaScript SDK, which is the canonical way to implement Facebook authentication. You can read more about the Graph API at http://developers.facebook.com/docs/api. Their library requires you to use the Javascript SDK to get the tokens. Their example for the App Engine requires it as well. While the methods do work and it is the library I have used for several projects, it doesn't handle everything within Python. With an IFrame canvas, I don't think there is any way to avoid using the Javascript SDK. If you can show an example controller that doesn't use Javascript that uses Python-SDK, I'd be interested in seeing that. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Pylons for Facebook apps
But the session data isn't the hard part. If you're using pyfacebook, they are already suggesting that you use the Javascript SDK to handle auth and just read the session information from there which really eliminates the need for anything but Javascript/Python. Your controller just needs to make sure that it gets/keeps that session data from page to page, whether internally or through their canvas methods. Unless you're still doing FBML, there is very little that your controller needs to handle beyond making sure there is a valid, current auth token and one is passed on each FB Canvas pageload, though, not your IFrame Canvas pageloads. If you're doing IFrame Canvas apps, you've already got to use Javascript to handle quite a few authorization features or write your own popup handlers with the Facebook look and feel. Once you have the auth tokens, the wrappers around the Graph API are fairly developed. I think what I would like to see is a FacebookController method that allowed me to pass in my app id, secret, key, desired permissions etc. and would handle that transparently. My actions would then know the fb_uid for each request, and perhaps could have a method defined that would pass a variable to each action that contained my local session info. At that point, I can concentrate on the app without worrying about other methods. When the graph API fails due to permissions, a handler in the Controller could optionally prompt the user to add additional permissions and carry the action through. Passing information through the Invites/Friend Tagging so that referrals could be tracked would also be nice. Having the controller or attached methods generate properly formed urls and messages to handle those tasks would be nice. As for FBConnect, I believe Velruse handles many different OpenID/ similar authentication systems, but, still needs a backend hook through repoze or something similar. I could be wrong. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: a very veard message pops up with pylons 1.0 with firefox
Can you run something like livehttpheaders to see what the url is being generated? Can you post the code from the form that is giving you the error? Are you using Toscawidgets? -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: using the secure_form helper
The import should be in lib/helpers.py rather than your controller so that it is exposed in your templates. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.