how to send feedback on new Sphinx docs?

2008-10-27 Thread Max Ischenko


There should be a simple way to send feedback on the docs.

I noticed a 404 link on the Forms page, how do I report it via
website?

(see para request is actually a WSGIRequest object documented here
and request.params is a MultiDict with documentation here.)
--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Elide content_type in conditional_response_app when status_int == 304

2008-10-27 Thread Luis Bruno

Howdy everyone, is this the WebOb complaint bureau?

I've added del response.content_type in my code, which I think it
should be done by WebOb automatically:

if 304 == response.status_int:
del response.content_type
return response(environ, start_response)

I calculate an ETag and use the conditional so it deals with the HTTP
caching details; wsgiref.validate throws an AssertError: if you're
not returning content, why do I see here a content-type?

More code below the fold (I compute the full body just after the HTTP
304 check):

class ConditionalJson(webob.Response):
default_conditional_response = True
default_content_type = 'text/javascript'

@selector.opliant
def part_in_json(self, environ, start_response, part_number):
etag = str(hash(str(part_number) + str(self.__created__) +
str(datetime.date.today(

req = webob.Request(environ)
conditional = ConditionalJson(etag = etag, last_modified =
datetime.date.today())
response = req.get_response(conditional)
if 304 == response.status_int:
del response.content_type
return response(environ, start_response)

Thanks!
--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



newbie: Passing c values through a re_direct?

2008-10-27 Thread Jules Stevenson

Hi List,

I'm very green to pretty much everything web framework related, so apologies
in advance...

Basically my problem is that I want to be able to access 'c' object values
after a 'redirect_to' call. I'm guessing from tests that I've done that this
isn't possible. 

The idea behind this is I have a page with a load of tools at the bottom -
when a user activates a tool the form submit controller does what it needs
to and then assigns a couple of values to c [c.statusText  c.statusCSS], it
then calls a redirect to the main page controller and these values are
*supposed* to give the user a text update based o nthe result of the form.
Obviously this fails because the c settings are lost through the redirect.

My controller code looks like this:

import logging

from pylonserve.lib.base import *
from pylonserve.model import *
log = logging.getLogger(__name__)


class CtrlProjectsController(BaseController):
 
def projectMenu(self):
c.clients = Session.query(ArkClient)
return render('/projectMenu.mako')
c.statusTemp = c.status

def formProjectAdd(self):
fData=request.params['projectName']
query=Session.query(ArkClient).filter(ArkClient.client.in_(fData))
if not query.first(): 
formClient=ArkClient(fData)
Session.add(formClient)
Session.commit()
c.status='Client Added'
c.ststusCSS='normal'
else:
c.status='Client allready exists. Not added'
c.statusCSS='error'
redirect_to(action='projectMenu')

I guess my question would be what's the simplest way to get a single page
with a load of forms on it to 'refresh' with updated info?

Many thanks for any info,

Jules


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: newbie: Passing c values through a re_direct?

2008-10-27 Thread Jules Stevenson

 If you just want to show a message on the destination page,
 webhelpers.pylonslib.Flash will do that.
 
 If you need something more elaborate, you'll have to pass the data as
 query parameters, cookies, or save it in the session (the
 pylons.session, not the SQLAlchemy Session).  Saving it in the session
 is the most convenient, and is how Flash works.
 
 If you're trying to redisplay a form you can do something with
 @validate, htmlfill, and/or calling an alternate action method.
 
Thanks Mike. Amazingly fast reply!

I found a link to this on the list as well, which was very useful:

http://groups.google.com/group/pylons-discuss/browse_thread/thread/a15de8d2d
69494d1/753240b52d254eda?lnk=gstq=c+object+redirect#753240b52d254eda

Jules


--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: how to send feedback on new Sphinx docs?

2008-10-27 Thread Ben Bangert

On Oct 27, 2008, at 12:15 AM, Max Ischenko wrote:


There should be a simple way to send feedback on the docs.

I noticed a 404 link on the Forms page, how do I report it via
website?

(see para request is actually a WSGIRequest object documented here
and request.params is a MultiDict with documentation here.


I'm adding a feedback to the new site, which should go up and replace  
both docs.pylonshq.com and beta.pylonshq.com this weekend.


In the meantime, feel free to email me directly and I'll update the  
docs.


Cheers,
Ben

smime.p7s
Description: S/MIME cryptographic signature


RE: newbie: Passing c values through a re_direct?

2008-10-27 Thread Jules Stevenson

  Saving it in the session
 is the most convenient, and is how Flash works.

I'm not sure what I'm doing, but the session object dosen't seem to be
holding any values, this is how I'm trying to manipulate the session object:

def formProjectAdd(self):
#
# validate!!
#
fData=request.params['projectName']
if fData !='':
query=Session.query(ArkClient).filter(ArkClient.client==fData)
if len(query.all())=0: 
formClient=ArkClient(fData)
Session.add(formClient)
Session.commit()
session['status']='Client Added'
session['statusCSS']='normal'
else:
session['status']='Client allready exists. Not added'
session['statusCSS']='error'
else:
session['status']='No text entered'
session['statusCSS']='error'
redirect_to('projectMenu')

When I check though a debug, the session keys have been set and are there...
session.keys():

['status', 'statusCSS', '_accessed_time', 'name', '_creation_time']

The mako files starts with this..

html
head
  titleArkMain/title
  ${h.rails.stylesheet_link_tag('/css/main.css')}
  ## ${h.rails.javascript_include_tag('/javascripts/effects.js',
builtins=True)}
/head
  
!-- left nav --
div id=left nav class=leftNav
${session.keys()}

And prints out: 

['_accessed_time', 'name', '_creation_time']

Any help much appreciated.

Jules



--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: newbie: Passing c values through a re_direct?

2008-10-27 Thread Mike Orr

On Mon, Oct 27, 2008 at 3:05 PM, Jules Stevenson [EMAIL PROTECTED] wrote:

  Saving it in the session
 is the most convenient, and is how Flash works.

 I'm not sure what I'm doing, but the session object dosen't seem to be
 holding any values, this is how I'm trying to manipulate the session object:

def formProjectAdd(self):
#
# validate!!
#
fData=request.params['projectName']
if fData !='':
query=Session.query(ArkClient).filter(ArkClient.client==fData)
if len(query.all())=0:
formClient=ArkClient(fData)
Session.add(formClient)
Session.commit()
session['status']='Client Added'
session['statusCSS']='normal'
else:
session['status']='Client allready exists. Not added'
session['statusCSS']='error'
else:
session['status']='No text entered'
session['statusCSS']='error'


Add session.save() here (and generally after making any changes).
Otherwise it will not update the persistent storage.


redirect_to('projectMenu')

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Zipping Pylons components on App Engine

2008-10-27 Thread Jorge Vargas

On Fri, Oct 24, 2008 at 3:19 AM, Mike Orr [EMAIL PROTECTED] wrote:

 I tried zipping some eggs for Pylons under Appengine-Monkey today.,
 For some reason the App Engine environment seems to honor directories
 listed in a .pth file but not zips listed in a .pth file, so I had to
 put the zips individually into sys.path.  So that was one step.


 A comparision by disk space comes in pretty much the same order.

 I couldn't believe Pylons had some many files so I looked at them.
 The largest chunk are images for the error pages, application
 templates, and tests.

This happen in Turbogears too back when we first find out about the
1000 files limit, and started working towards getting this working on
appengine (of course that won't happen until pylons can) but some of
TG is already going this way. It was decided to split the package into
two, that is why you currently install tg.devtools and turbogears2.
The idea is that anything related to paster (templates and commands
currently) is only useful in development environments (like the GAE
sdk), but it's just cruft on the deployment (real GAE), this made the
tg package less than 20 files + tests, which can be stripped of a
deployment egg if 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Start action at the specific time.

2008-10-27 Thread Jorge Vargas

On Sat, Oct 25, 2008 at 6:06 AM, gra2n [EMAIL PROTECTED] wrote:

 Is there posibility to start some action at specific time in Pylons
 without user action ?? For example I have in my database a group of
 things to do and time when to start doing them. My problem is to
 implement function which check from time to time if there is planned
 operation and start this operation.   I think that something like that
 should be possbile to do but I don't know how.

This is outside of the scope of pylons, ideally you should have it
done totally outside of the webserver. Either with a cron job, the
python's scheduler module [1] or another sort of standalone script,
Turbogears1 has this [2] and it could be used standalone, in fact it's
some imported code with minor modifications. so in the end you will
have to use a combination of the alternatives.

You should start by looking at the using the model outside pylons page
[3], then i'lll recommend writing a python script (without sched or
tg1 scheduler) and then using cron to do the job, or write it in full
python that's your call.

[1] http://www.python.org/doc/2.5.2/lib/module-sched.html
[2] http://docs.turbogears.org/1.0/Scheduler
[3] 
http://wiki.pylonshq.com/display/pylonscookbook/Accessing+your+model+outside+of+Pylons

--~--~-~--~~~---~--~~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---