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
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
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
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.
--~--~-~--~~~---~--~~
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
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
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
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
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('%',
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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?
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!
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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:
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:
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
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
(
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
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
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
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
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
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
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',
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
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 (
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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,
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 (
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
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
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
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
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
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,
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.
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
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
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
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
1101 - 1200 of 1274 matches
Mail list logo