Re: 'ScopedSesson'

2009-03-17 Thread Jonathan Vanasco
add() is the name in SA.5 for save() in SA.4 session.add() replaces session.save(), session.update(), session.save_or_update(). - the session.add(someitem) and session.add_all([list of items]) methods replace save(), update(), and save_or_update(). Those methods will remain deprecated throughout

Re: Relative imports

2009-03-17 Thread Jonathan Vanasco
don't you just want to do this... $cd RandomDirectory $touch __init__.py import it as from PylonsProject.RandomDirectory.file8 import * --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss

Error on upgrading from .9.6 when touching Headers in response

2009-03-12 Thread Jonathan Vanasco
in .9.6 setting headers like this worked: response.headers['Content-Type'] = 'application/ms-excel' in .9.7 , anything i do to them is met with this AttributeError: You cannot access Response.unicode_body unless charset is set looking at the new webob docs, i tried doing

Re: Error on upgrading from .9.6 when touching Headers in response

2009-03-12 Thread Jonathan Vanasco
to add: response.content_disposition 'works' in that it doesn't cause an error. but it's not respected. i've yet to test headers for 'cache-control' , 'pragma' , and 'expires'. needless to say, this is a very annoying bug/behavior change. --~--~-~--~~~---~--~~

Re: 'who is online' feature

2009-03-10 Thread Jonathan Vanasco
that would be a bit of overhead too -- you'd be constantly doing reads/ writes personally, i'd do this: 1) use a db table to maintain a list of all the people logged in as: [ (uid,displayname,timestamp_last_action), repeat ] 2) when someone logs in / out - modify that entry , have pylons check

Re: Problem with javascript content files loaded three times.

2009-03-10 Thread Jonathan Vanasco
is this content being requested from the server each time? try putting a print command in your base controller -- and have it print out all the headers my guess is that firebug is behind all this - either requesting info 2 more times , or just having a weird loop on showing source. like Tom

Re: 'who is online' feature

2009-03-09 Thread Jonathan Vanasco
On Mar 9, 7:33 am, zepolen zepo...@gmail.com wrote: Add a 'last_action' datetime column to your user database, and do: UPDATE users SET last_action = now() WHERE username = 'someuser' on every nth request a (logged in) user does. As for getting the current logged in users SELECT username

Re: Javascript in template

2009-03-08 Thread Jonathan Vanasco
why not just paste that entire bit of javascript into the template there is no need to use any webhelpers stuff. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send

Re: authkit render template error

2009-03-03 Thread Jonathan Vanasco
I don't like that example. Mako IS a templating engine. So the author has you rendering the mako templates AND THEN doing string substitution ? that's pointless. anyways... your error on render_signin is happening because of this line: result = result.replace('%',

Re: sqlalchemy eagerloads don't store in cache ?

2009-03-02 Thread Jonathan Vanasco
in this instance we're not caching for output... there are some very expensive sql queries on ArtWeLove.com to alleviate that, i create an object per-artist / venue / show / etc and store it in memory for 15minutes these objects have the basic sql table, some extended sql queries, and between

sqlalchemy eagerloads don't store in cache ?

2009-02-26 Thread Jonathan Vanasco
i've been doing some aggressive caching and realized this issue. i'm wondering if this is just on my system for some odd reason... 1) i load a sqlalchemy object from model, and eagerload associated objects into it 2) i store that object into a cache ( the pylons caching facility, which is from

Re: looking for freelance work (pylons/python)

2009-02-25 Thread Jonathan Vanasco
On Feb 25, 1:09 pm, Ben Bangert b...@groovie.org wrote: Cool, you'll notice in the templates/layout.mako that there's a Jobs   section under Community that's commented out. My thought for the   section was to have the latest jobs listed on the main page, with a   left side bar for employers

new pylons site - ArtWeLove.com + Open Source Framework

2009-02-24 Thread Jonathan Vanasco
We just launched ArtWeLove.com Everything but the /news section is in Pylons . The /news section is a customized install of MovableType. Some cookies , PHP , and a whole bunch of postgresql views in Pylons to map the MT structure tie everything together. Its got a few bugs -- we launched a

Re: Super controller or WSGI for dynamic frontpage?

2009-02-23 Thread Jonathan Vanasco
you should definitely aggressively cache your front page. ideas: 1- cache on the view or admin tool to an html file 2- cache on the view or admin tool to a php file, and use cookies to customize data 3- cache on the view or admin tool to an html file, and use js to customize data through

Re: Pylons 0.9.7 released

2009-02-23 Thread Jonathan Vanasco
congrats ben! On Feb 23, 2:46 pm, Ben Bangert b...@groovie.org wrote: Pylons 0.9.7 has been released, I've posted a full write-up on it on   the PylonsHQ site:http://pylonshq.com/articles/archives/2009/2/pylons_097_released Cheers, Ben  smime.p7s 3KViewDownload

dealing with cookies

2009-02-23 Thread Jonathan Vanasco
i've got an annoying issue with cookies... in my setup, i unfortunately had some cookies baked with www.domain.com and others with domain.com this didn't cause an issue in pylons, but it did cause an issue in a section of the site that was offloaded to php ( which was running a blog, and

Re: dealing with cookies

2009-02-23 Thread Jonathan Vanasco
Thanks Gustavo. I was afraid of that. I guess I just need to change the cookie name and have some sort conversion facility. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this

0.9.7 bug - no g in inherited templates when formerror parsing ( @validate decorator )

2009-02-22 Thread Jonathan Vanasco
figuring out what happened drove me crazy all day... this worked in 0.9.6 , but its broken in 0.9.7: if you fail an @validate test on a formencode form, you'll error out if you try to access a g variable in an inherited template g is available in the regular template. just not in the

Re: 0.9.7 bug - no g in inherited templates when formerror parsing ( @validate decorator )

2009-02-22 Thread Jonathan Vanasco
actually, strike that. more testing and I found out that there was a stray entity the parser didn't like. sigh. sorry folks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this

has anyone used a mako template to generate a mako template ?

2009-02-20 Thread Jonathan Vanasco
i'm wondering if this is possible, as I haven't figured out the correct escaping yet. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

Re: has anyone used a mako template to generate a mako template ?

2009-02-20 Thread Jonathan Vanasco
nice idea! thanks! backslash-escape doesn't work. nor does any other escape character. i only found one other person trying to do this on the mako list, but htey never got an answer from a 2007 posting... so you rock! --~--~-~--~~~---~--~~ You received this

the thing i really don't like about routes...

2009-02-19 Thread Jonathan Vanasco
is that the 'controller' argument isn't actually the name of the controller. its the name of the package that the controller is in. (?!?) i've mentioned this before, but my hatred for this has only grown tenfold since then. I wanted to gripe while revisiting old code.

Re: 404 Not Found nice orange screen and debug console

2009-02-19 Thread Jonathan Vanasco
On Feb 19, 10:57 am, przemek.ch przemek...@gmail.com wrote: Where can I catch that error? That i do not know... And How can I disable the debug console completely, and show to the user - an error occurred or something like that. there are 2 debug lines in your ini , one shows the traceback

Re: the thing i really don't like about routes...

2009-02-19 Thread Jonathan Vanasco
its just so confusing how the find_controller works. It is? What part of it did you find confusing? I thought there were a   good amount of comments on any section that might be confusing. I'd be   happy to explain it further if there was a part that was confusing. Oh, i mean the code is

Re: the thing i really don't like about routes...

2009-02-19 Thread Jonathan Vanasco
mike- i like your concept my issue stems from looking at my routing file, and then thinking for the first time that i was looking at old perl code and not python! should i assume that because of this behavior, people should never have more than one controller in a file?

Re: the thing i really don't like about routes...

2009-02-19 Thread Jonathan Vanasco
On Feb 19, 4:52 pm, Mike Orr sluggos...@gmail.com wrote: Using the standard PylonsApp, no.  The controller class is calculated from the module name, and that doesn't allow for multiple controllers per file. The docs should reflect this then, because this is the first I've ever heard of it!

timestamp in error reporting?

2009-02-17 Thread Jonathan Vanasco
Going through logs during testing to find bugs, i noticed that the errors don't include the a timestamp/datetime item is there any way to make that happen, either hardcoded in or pulling in the format from the logger configuration? The error reports i'm talking about are the ones with the

does anyone freelance on pylons ?

2009-02-12 Thread Jonathan Vanasco
we may need some extra hands on a project for a few weeks. the marketing team has been over-performing , and our launch outreach may be bigger than we're currently ready for. contact me offlist - jonat...@findmeon.com - if you freelance. --~--~-~--~~~---~--~~ You

Re: storing formattable strings in the config file?

2009-02-09 Thread Jonathan Vanasco
that only sort-of-works: i have to do it like this: stringed= (config['varname']).replace( '\\x25', '%' ) print stringed % {dict} better than nothing, but it would be nice if there were a better option. --~--~-~--~~~---~--~~ You received this message because you

issue on upgrading to 0.9.7

2009-02-09 Thread Jonathan Vanasco
this is a little complex, so bear with me... we developed a 'framework' that runs on pylons and consolidates core functionality for the kind of webapps we build or consult on. something peculiar to the framework is that we need to access the real application's model , helpers , etc from the

is there a way to call render with string teamplates?

2009-02-06 Thread Jonathan Vanasco
ie -- instead of passing in a file, passing in a string? the only way i can think of this right now is with a tmpfile, and i'd like to avoid that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss

storing formattable strings in the config file?

2009-02-06 Thread Jonathan Vanasco
i want to store something in my config file like foo %(bar)s normally in python, i would do this foo %%(bar)s to escape the string interpolation. paste doesn't like that. anyone have a suggestion. --~--~-~--~~~---~--~~ You received this message

Re: is there a way to call render with string teamplates?

2009-02-06 Thread Jonathan Vanasco
ok, this has given me ideas! --~--~-~--~~~---~--~~ 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

Re: monit + pylons under Ubuntu 8

2009-02-06 Thread Jonathan Vanasco
wow , i totally forgot about this... its been 8 months! i ended up making a shell script to wrap start/stop/restart on paster, and use monit to trigger that i'll post it soon! and i'll look into your supervisor info. in practice, monit is less of a daemon manager than it is a daemon monitor.

Re: is there a way to call render with string teamplates?

2009-02-06 Thread Jonathan Vanasco
well, for this purpose I know that the templates will ALWAYS be mako -- its a failsafe built-in template for a distributed system that is only used if not overridden. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: clean up after session finished

2009-02-05 Thread Jonathan Vanasco
On Feb 5, 12:17 pm, Christopher Barker chris.bar...@noaa.gov wrote: Another option would be to set a Javascript timer to ping the server every once in a while. You could then set your sessions to expire pretty quickly. As long as the user had that page open, the client would keep getting the

Re: Pylons reload signal?

2009-02-03 Thread Jonathan Vanasco
On Feb 4, 1:36 am, Kevin Baker kba...@missionvi.com wrote: I am trying to reload with as little impact on uptime as possible. With apache I do a /etc/init.d/apache2 reload rather than restart for the same effect. That's actually not very good... there are a few 'memory leaks' that can

Pylons vs Thundercats

2009-01-30 Thread Jonathan Vanasco
If we're going to make ridiculous comparisons, I vote for a thread on this one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

Re: Pylons vs Thundercats

2009-01-30 Thread Jonathan Vanasco
On Jan 30, 1:02 pm, Tom Longson (nym) toml...@gmail.com wrote: Thundercats for the win, no question. See I'd think that first , but 1) Agility Pylons is fast enough. Thundercats are very fast, but they have Snaf, who is fat and lazy. As a whole, he brings them down. 2) Enemies Pylons has

Re: query inside Model?

2009-01-26 Thread Jonathan Vanasco
Yes and no. I don't agree with the default Pylons session approach -- where you have 1 global db session. I tend to use a mixture of 2 things to handle sessions in the Model: 1- A Factory class manages a session pool and which type is active ( read, write, log, etc). I call out to the factory

Re: Looking for Pylons speakers

2009-01-26 Thread Jonathan Vanasco
Josh - Do you know when the deadline for submissions is? I'm about to release a Pylons/PG open source project. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email

FormEncode and International Languages

2009-01-26 Thread Jonathan Vanasco
How are people dealing with FormEncode and International Languages? Our project is dealing with a lot of French writers typing things like é , which fails many formencode tests. This is more of an 'approach' issue: - how are you handling internationlization in Pylons from a business standpoint

Re: FormEncode and International Languages

2009-01-26 Thread Jonathan Vanasco
fair on some points, i disagree with others. i'm in the US. the formencode author seems to be as well. 'internationalization' on most things seems to be limited to swapping in text. many of the checks, such as PlainText allow for only a subset of ascii. anything else trips an error. short

Re: State of Auth with Pylons

2009-01-23 Thread Jonathan Vanasco
I think Pylons should only support Authentication as in http auth that is supported by Apache/Nginx/Etc , and things like mod_auth / ldap / etc. It would be nice if it supported some sort of tie-in with services that proxy to/from it to make that auth persist. But everything else that people do

wishlist - config based encoding for redirect_to

2009-01-22 Thread Jonathan Vanasco
basically, i'd love to see a pylons config option like this: redirect_encoding= ascii which would just do url.encode('ascii') on urls submitted to redirect_to -- or any other encoding standard. we ran into a bit of a problem with our docs being utf8 and older browsers not liking the redirect

Re: On disk data files

2009-01-21 Thread Jonathan Vanasco
If you're authoring them, a good place would probably be a subfolder of config or lib of the distributions app folder. If these are automatically generated / cached, i like to put them in the data folder of the distribution. i also use prefixing/reverse namespace to avoid collisions ie:

best ways to deal with bool values in config ?

2009-01-21 Thread Jonathan Vanasco
i store a lot of stuff in config, much of which is 'framework' related across modules. the current way i deal with bools is this ( by storing things in app_globals during init ) g.enable_feature_x= False if 'org.opensn.pylons.enable_feature_x' in config:

Re: memcached beaker support

2009-01-20 Thread Jonathan Vanasco
woot!!! On Jan 20, 12:38 pm, Ben Bangert b...@groovie.org wrote: On Jan 19, 2009, at 11:04 AM, Jonathan Vanasco wrote: any chance the next version of beaker will be better integrated with pylons so it doesn't flush to the datastore on ever save( The current code in trunk does

how to - read uploaded images more than 1x

2009-01-19 Thread Jonathan Vanasco
this is annoying me... just realized that some code has been failing because it is reading an image upload twice. the first time is fine. the second time is empty. it seems this is because the file is stored as a socket._fileobject (

Re: how to - read uploaded images more than 1x

2009-01-19 Thread Jonathan Vanasco
just to add... i'm currently using a workaround of reading this into a cStringIO.StringIO object that supports seek(0) -- i just think its a little silly that I need to do that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: memcached beaker support

2009-01-19 Thread Jonathan Vanasco
any chance the next version of beaker will be better integrated with pylons so it doesn't flush to the datastore on ever save() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this

Re: hasattr and context object

2009-01-19 Thread Jonathan Vanasco
i believe AttribSafeContextObj are a convenience method for templates its really a PITA to look at and maintain % if hasattr( c , 'name '): so we have a cleaner % if c.name : if you'd rather the templates work as python does (and less like templating languages ) you can use the ContextObjm

Re: Exploring ramework futures

2009-01-19 Thread Jonathan Vanasco
awesome news we're tidying up the Open Social Network framework for its first public release right now. its built on top of pylons and would do well from many of these concepts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Scripting API in addition to web app

2009-01-12 Thread Jonathan Vanasco
The Original Poster was not talking about a WEB API for REST/JSON, he said Command Line API --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

redirect_to in __init__ ?

2009-01-05 Thread Jonathan Vanasco
is there a way to handle a redirect_to in an __init__ , or does it need to be in __before__ ? pylons executes the code 'right' in an __init__ block, but breaks with the raise found --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Routes user survey

2008-12-18 Thread Jonathan Vanasco
I can't seem to reply to the 'group', so i'm emailing the group address and 2 vocal people, hoping for the best. apologies if you get this 2x. something that i would LOVE to see in routes, is this: right now, routes maps like this: map.connect( 'faq_page', 'faq', controller='semi_static',

Re: pylons and jquery - restricting POST calls

2008-10-26 Thread Jonathan Vanasco
while jquery uses GET or POST as the default for many 'ajax' calls quite arbitrarily: 1- You can explicitly call a GET or POST as a function 2- Most functions have GET/POST params to override the function IIRC, i think one of the LOAD options uses GET, but pylons wants POST for the @auth

Re: Shutdown hook

2008-10-09 Thread Jonathan Vanasco
after reading that i thought catch signal? and then yahoo search said import signal and someone seems to have worked on the same issue-- http://stevemorin.blogspot.com/2005/11/python-shutdown-hook-method-update.html from what i've read, you probably want a couple of ways to catch the exit (

Re: Exposing an SQLAlchemy class model to an RIA?

2008-09-29 Thread Jonathan Vanasco
would you want a desktop client to have 'all' operation and access to the objects methods and fields? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

Re: Exposing an SQLAlchemy class model to an RIA?

2008-09-29 Thread Jonathan Vanasco
i brought this up to start thinking about architecture... i think you have 3 basic ways to handle this: 1- the js just talks to an API which delegates what is allowed or not 2- each python class has a an internal dict/array/etc of the externally available functions that it allows access to.

Re: How to make graphs with date/time as the X-axis?

2008-09-25 Thread Jonathan Vanasco
in the past i've used - php/swf charts ( http://www.maani.us/xml_charts ) - reportlab and a few other apps . i often go for the flash version when possible -- just spitting out raw data and making use of a UIX designed by front end people not backend libraries

Re: how to rename and deploy a pylons app?

2008-09-24 Thread Jonathan Vanasco
I've had to do this before... you'll want to rename the appropriate files / directories , and then replace all the module name instances in your project ie: if your project is named ASDFGHJK , then you'll need to rename: /ASDFGHJK /ASDFGHJK/asdfhjk /ASDFGHJK/asdfhjk.egg-info then do a

Re: Error management

2008-09-18 Thread Jonathan Vanasco
not the answer you're looking for, but: the error meessage is generated by the error controller. you could poke around in there and see if any c vars are set or other good stuff usually for showing users a 'meaningful' message, i do this: i - i have a WebError and JsonError exception class ii

Re: Is AuthKit still acrively being developed?

2008-09-12 Thread Jonathan Vanasco
On Sep 12, 8:38 am, Bartosz R [EMAIL PROTECTED] wrote: Some claim (http://beta.stackoverflow.com/questions/47801) that it is not. And so it seems that the last commit was 2 months ago... Can anyone clarify? trac histories are really confusing now... a lot of projects have moved to git for

Re: Is AuthKit still acrively being developed?

2008-09-12 Thread Jonathan Vanasco
i was just talking about open source projects in general... a lot of people seem to be leaving subversion for git, or mercurial, or other more distributed apps, and only syncing to the main svn repo on a major release nothign bad about that -- it just makes some projects look inactive when

Re: PROPOSAL: session.id should be guaranteed, set-cookie after session access is canceled only by session.invalidate()

2008-09-12 Thread Jonathan Vanasco
Michael- This sounds great. Might I ask your input on two other beaker ideas? i. the option to have a facility that queues save() calls, but not actually save until another call / param is passed (in middleware somewhere), so that we can do 1 write to disk at once ii. an option to create new

Re: how do i get all the 'select multiple' options from request.params ?

2008-09-04 Thread Jonathan Vanasco
not get(), but getall() --~--~-~--~~~---~--~~ 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 [EMAIL

Re: Which is the best way to make a variable available to all templates?

2008-09-02 Thread Jonathan Vanasco
i took an awkward approach to this that I like rather well... 1- I created a middleware layer which makes a new SOP 'open_social_network' out of 'from pylons.util import AttribSafeContextObj' 2- On app startup, i populate a globals hash with the config values 3- My basecontrollers all derive

Re: updating user and current controller state to template

2008-08-24 Thread Jonathan Vanasco
it would be more correct to update c , and not the 'base controller' in any event, i think you might have better luck setting 'self.main_panel' instead of BaseController.main_panel messing with class vars can create problems down the road. after you set BaseController.main_panel in your

Re: response status when form validation fails

2008-08-24 Thread Jonathan Vanasco
On Aug 23, 2:20 am, Mike Orr [EMAIL PROTECTED] wrote: I want to work on this when I have time because there are so many cases where @validate is too monolithic.  (E.g., need a database record to validate against, don't need a whole validator class.)  In the meantime there's code in the

Re: response status when form validation fails

2008-08-22 Thread Jonathan Vanasco
I'll admit at the forefront, I'm not a fan of the extreme 'restification' of the web the way the rails evangelists and followers have pushed for, or the 'restful web services' crowd. http is the transport protocol. its in the name -- Hypertext Transfer Protocol throwing a 400 on a form error

where should beaker bugs / issues / feature requests be listed ?

2008-08-21 Thread Jonathan Vanasco
anyone know ? it's hard to figure it out since it seems half/pylons, half/elsewhere , and the trac is showing the latest git but not tags. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To

Re: response status when form validation fails

2008-08-18 Thread Jonathan Vanasco
i'm not sure if i like the idea of this. the 400 error is for bad/malformed syntax and the request can't be fulfilled. in this situation, the http level request is most certainly understood and authorized -- the error is in the application logic and should be served on such -- not pushed into

Re: Pylons on Google App Engine

2008-07-21 Thread Jonathan Vanasco
php is a templating language. all that stuff is written in c and is optimized. php is WAY faster at variable interpolation than python, perl, everything else. templates are a small fraction of your 'business logic'. 95% of what you do in pylons, php, and everythign else will have the database

Re: Pylons on Google App Engine

2008-07-21 Thread Jonathan Vanasco
On Jul 21, 11:57 am, Jens Hoffrichter [EMAIL PROTECTED] wrote: I don't want to start a religious discussion about programming languages here, especially about speed and ease of use. I don't either, but I need to clarify something. I think in context of the question and the response, it was

Re: Recommended way to build forms

2008-07-15 Thread Jonathan Vanasco
the current formencode and htmlfill support is a bit... annoying since it ships with pylons, its 'recommended', but i wouldn't recommend it: 1- you can't validate a form outside of using the decorator 2- you can't pull an error or redirect outside of the decorator 3- it 'validates' but doesn't

Re: Debugging failed tests with pylons globals

2008-07-11 Thread Jonathan Vanasco
I don't think that SOPs are the devil... I think the issue has more to do with how and where items are instantiated and stored. I think if the load order were different ( i'm not going to make any suggestions ;) ), and how we get at them, then many of the end-user issues could disappear.

Re: about pylons's data validation

2008-07-08 Thread Jonathan Vanasco
Read this http://wiki.pylonshq.com/display/pylonsdocs/Form+Handling --~--~-~--~~~---~--~~ 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

Re: tests fail because of g

2008-07-07 Thread Jonathan Vanasco
hm... in this instance, i use g for three things: 1- on startup, i pull constants out of the DB and stash them into g 2- misc form classes refer to g as the values to use for validation 3- templates use them to generate dropdowns i guess i could use some sort of factory function to pull g on

Re: best way to get user's IP address in pylons?

2008-07-07 Thread Jonathan Vanasco
On Jul 7, 1:46 pm, Ian Bicking [EMAIL PROTECTED] wrote: Christopher Weimann wrote: REMOTE_ADDR is typically set by your webserver and can be trusted.   X_FORWARDED_FOR is an HTTP header typically set by proxy servers or even the client and I would have to say it can NOT be trusted so

Re: Severe security vulnerability?: ajax shell in traceback

2008-07-06 Thread Jonathan Vanasco
On Jul 6, 2:54 pm, Mike Orr [EMAIL PROTECTED] wrote: Hi all.  I think a better solution is for devlopment.ini to listen only on localhost by default.  I've opened a ticket for it:http://pylonshq.com/project/pylonshq/ticket/483 That's a great idea -- and should be implemented! However, just

Re: Exposing database Id via URL

2008-07-05 Thread Jonathan Vanasco
On Jul 5, 4:06 pm, jerry [EMAIL PROTECTED] wrote: However, I wonder how an md5 string can be squeezed into a 10, or even 6-character field with no concern of (future) collision -- or am I mis- understanding your db schema? You're misunderstanding the concept. 1. md5(random+time) to get a

tests fail because of g

2008-07-05 Thread Jonathan Vanasco
I have several helper classes that use g from pylons I get tons of errors when trying to run tests ( via python setup.py nosetests ) as importing those packages causes this: TypeError: No object (name: G) has been registered for this thread

Re: Exposing database Id via URL

2008-07-04 Thread Jonathan Vanasco
just some points on 'hiding' ids- - if you're doing a social media site, with numeric ids your competitors and the annoying industry blogs will be judging and guaging your popularity and success by sequence ids - by using the ids, you're good on a pylons app... but lets say you need to offload

routes suggestion

2008-07-04 Thread Jonathan Vanasco
any chance of patching routes/base.py with this: 671,672d670 if not routename and 'name' in kargs: routename = kargs['name'] it just sets the routename to the karg 'name' if its supplied and there's no name already specified why? personally, i like to manage my

Re: best way to get user's IP address in pylons?

2008-07-03 Thread Jonathan Vanasco
On Jul 3, 4:42 pm, Wichert Akkerman [EMAIL PROTECTED] wrote: Possibly better:   request.environ.get(X_FORWARDED_FOR, request.environ[REMOTE_ADDR]) maybe someone can make a middleware or pylons patch + config setting that migrates X_FORWARDED_FOR to REMOTE_ADDR this is the one i maintain for

Re: Beaker session API feature request

2008-06-29 Thread Jonathan Vanasco
I don't really understand what you're saying... but from what I think you're trying to suggest, I'd have to disagree with this concept. Sessions simply allow information to persist between requests. Going into sessions and mangling them outside of the request is a very unique requirement that

Re: Testing with the session object

2008-06-28 Thread Jonathan Vanasco
On Jun 28, 7:18 am, Shannon -jj Behrens [EMAIL PROTECTED] wrote:  * Use one action to put something into the session and then another to make use of the session.  It's a work flow. I've always thought that Pylons should have something that does that. ie: instead of being a beaker object,

Sanitizing User Input

2008-06-28 Thread Jonathan Vanasco
I need to sanitize user input for 'comments' and 'postings'. Can anyone suggest good ways to handle this? Browsing the web and other projects, it seems most people do this: - use beautiful soup ( which i think might be overkill ) - use a sanitize function from sam ruby's mombo/post.py (

Re: File Uploads Issue / Question

2008-06-27 Thread Jonathan Vanasco
On Jun 27, 3:16 pm, Mike Orr [EMAIL PROTECTED] wrote: I got that same problem.  it's a bug in the upload object used by cgi.FieldStorage.  You can't test it for truth or booleanize it. Nice to know I'm not alone. Or a really inept programmer. Instead you can compare it to None: if

Slightly OT - Testing Browsers with Pylons

2008-06-27 Thread Jonathan Vanasco
Just wondering what people use to test Pylons webapps with. I've been using Safari myself. I wanted to use Firefox badly, but the 3.0 branch has 2 behaviors that seem to make development impossible: - if Pylons generates an error, Firefox will attempt to reload the page 4more times

Re: Dynamically Choosing A Rendering Engine

2008-06-26 Thread Jonathan Vanasco
well a few things i'd suggest from previous exploits in other languages ( btw, have you looked into pylons.templating ? ) - have render take a format argument to override - instead of pulling off the config, why not just read the file extension ? pretty much every templating engine has claimed

How are c/h/etc provided to templates?

2008-06-24 Thread Jonathan Vanasco
I'm trying to make two other objects available to all templates. I'm wondering what the best practice would be. Looking at pylons.templating, I'm honestly a bit confused about what is going on. ( and if you're wondering: object1 is a version of pylons.c that is for the underlying framework we

Re: performance

2008-06-24 Thread Jonathan Vanasco
Pylons can be slow as fuck, and it still rocks. If you're managing a project, you have two numbers to worry about: - the efficiency of your stack in executing code - the efficiency of your developers in writing code Pylons is FAR from being what I would call 'efficient' in terms of code

Re: Pylons equivalent of cherrypy's serve_file?

2008-06-24 Thread Jonathan Vanasco
disclaimer - i'm no authority on pylons. the stock error controller (automagically generated) handles the magic error pages it has this in there: def img(self, id): Serve Pylons' stock images return self._serve_file(os.path.join(media_path, 'img', id)) def style(self,

Re: How are c/h/etc provided to templates?

2008-06-24 Thread Jonathan Vanasco
wait, i'm looking at this again... i'm not seeing any way to push custom vars into the render function outside of monkeypatching or doing something to render i could put my new objects in pylons.c / pylons.g there trivially, but i dont think i can bust out of them cleanly.

Re: Reddit open sources their site pylons implementation

2008-06-22 Thread Jonathan Vanasco
The new PylonsHQ site I'm working on now will have a Snippets section   to make it easier to find and share these bits. That's cool! The approach we're doing is as follows: - We distill functionality into a module - The module uses class variables to store templates and urls - To use

Re: Background Threads

2008-06-21 Thread Jonathan Vanasco
i've done two things to handle this in the past: 1- CRON I used to just write a simple script to handle it all, then have cron run at 1,5,10,15,30,60 minute intervals or whatever.. and use some PID files to make sure I don't have an overlap in execution 2- Twisted Now I often just run a twisted

Re: url_for for static resources

2008-06-21 Thread Jonathan Vanasco
i had a similar situation -- i wanted to change url_for's output on people who have a 'preview' cookie and those who don't i basically did this def url_for_custom( url ): rval = url_for(url) if logic_test(): rval = regex or stringsub or both return rval then quickly did a

Re: Reddit open sources their site pylons implementation

2008-06-19 Thread Jonathan Vanasco
This is really great! We've been working on OpenSourcing a bunch of our stuff, and its nice to see some overlap on some things... and find inspiration on others. Dalius- Do you know the python OpenID libraries well? Prerhaps I could convince you to help us with an openid plugin for our project

<    7   8   9   10   11   12   13   >