Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Helpers in 0.9.7
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
edgarsmolow  
View profile  
 More options Mar 16 2009, 5:06 pm
From: edgarsmolow <edgarsmo...@gmail.com>
Date: Mon, 16 Mar 2009 14:06:09 -0700 (PDT)
Local: Mon, Mar 16 2009 5:06 pm
Subject: Helpers in 0.9.7
I recently began development with Pylons 0.9.7.  The online docs
suggest using a function called url_for that should be in
myproject.lib.helpers.py.  But, the file is essentially empty.

Is helpers.py supposed to come with any functions at all, or are we
supposed to write url_for (and any others mentioned in the docs)?

Thanks.
Edgar


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Dickson  
View profile  
 More options Mar 16 2009, 5:14 pm
From: John Dickson <capts...@gmail.com>
Date: Tue, 17 Mar 2009 07:14:58 +1000
Local: Mon, Mar 16 2009 5:14 pm
Subject: Re: Helpers in 0.9.7

Hi Edgar

You normally add the imports you want to helpers.py, which then makes them
available as "h.some_import".  For example, I use the following line to get
the url_for() function:

  from routes import url_for

Cheers ........................ JD

2009/3/17 edgarsmolow <edgarsmo...@gmail.com>

> I recently began development with Pylons 0.9.7.  The online docs
> suggest using a function called url_for that should be in
> myproject.lib.helpers.py.  But, the file is essentially empty.

> Is helpers.py supposed to come with any functions at all, or are we
> supposed to write url_for (and any others mentioned in the docs)?

> Thanks.
> Edgar

--
   /Angle-parked in a parallel universe.../

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
edgarsmolow  
View profile  
 More options Mar 16 2009, 6:36 pm
From: edgarsmolow <edgarsmo...@gmail.com>
Date: Mon, 16 Mar 2009 15:36:59 -0700 (PDT)
Local: Mon, Mar 16 2009 6:36 pm
Subject: Re: Helpers in 0.9.7
Thanks, John, but that's not my question.
My question is not about how to access functions in the module.  My
question is about why the documentation talks about using the url_for
() function, but it is not present in the module.  Are we expected to
write it ourselves, or was there a problem in the WAY I set up the
application?  For instance, perhaps I missed a step...

Thanks.
Edgar

On Mar 16, 5:14 pm, John Dickson <capts...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wyatt Baldwin  
View profile  
 More options Mar 16 2009, 8:15 pm
From: Wyatt Baldwin <wyatt.lee.bald...@gmail.com>
Date: Mon, 16 Mar 2009 17:15:17 -0700 (PDT)
Local: Mon, Mar 16 2009 8:15 pm
Subject: Re: Helpers in 0.9.7
Sounds like an error in the docs. In the particular case of
``url_for``, John's suggestion is probably what you want. Other "built
in" helpers can be found in the WebHelpers package. In earlier
versions of Pylons, helpers.py included these imports for you; now,
you import the ones you want.

On Mar 16, 3:36 pm, edgarsmolow <edgarsmo...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Dickson  
View profile  
 More options Mar 16 2009, 8:52 pm
From: John Dickson <capts...@gmail.com>
Date: Tue, 17 Mar 2009 10:52:44 +1000
Local: Mon, Mar 16 2009 8:52 pm
Subject: Re: Helpers in 0.9.7

Hi Edgar

OK, a minor misunderstanding there...

As far as I know, the helpers module is there for whatever *you* want to be
easily available in the UI code for *your* app.  Pylons doesn't (and
probably couldn't) provide a standard helpers.py that is right for every
application.  This also seems to fit the pattern of the other modules
generated in /config and /lib for your application

So, if you want to use a function like routes.url_for() in your UI, the easy
way to achieve this is to import it in helpers.py (as I showed below) - then
you can access it as h.url_for() in your controllers, templates etc.  It's
also common to import things like "webhelpers.html.tags.*" etc.,
particularly for form handling.

Hope this helps ............................ JD

2009/3/17 edgarsmolow <edgarsmo...@gmail.com>

--
   /Angle-parked in a parallel universe.../

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jose Galvez  
View profile  
 More options Mar 16 2009, 9:31 pm
From: Jose Galvez <jj.gal...@gmail.com>
Date: Mon, 16 Mar 2009 18:31:56 -0700
Local: Mon, Mar 16 2009 9:31 pm
Subject: Re: Helpers in 0.9.7
I think the docs are a little out of sink with where pylons is at the
moment.  Earlier versions of pylons imported a lot of stuff into the
helpers file so they were there by default, which is reflected in the
docs.  Now however, your expected to import what you need, being
explicit rather then implicit.  Having said that I know the docs are a
little out of since and thats really frustrating with new users.  Read
the section on upgrading
http://pylonshq.com/docs/en/0.9.7/upgrading/  its pretty informative.

Jose


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philip Jenvey  
View profile  
 More options Mar 17 2009, 1:53 am
From: Philip Jenvey <pjen...@underboss.org>
Date: Mon, 16 Mar 2009 22:53:16 -0700
Local: Tues, Mar 17 2009 1:53 am
Subject: Re: Helpers in 0.9.7

On Mar 16, 2009, at 2:06 PM, edgarsmolow wrote:

> I recently began development with Pylons 0.9.7.  The online docs
> suggest using a function called url_for that should be in
> myproject.lib.helpers.py.  But, the file is essentially empty.

> Is helpers.py supposed to come with any functions at all, or are we
> supposed to write url_for (and any others mentioned in the docs)?

The official docs here: http://pylonshq.com/docs/en/0.9.7/ don't refer  
to url_for anywhere. The articles on the cookbook and also the online  
copy of the book may be a little out of sync and still refer to  
url_for/h.url_for. url_for still works, but the pylons.url global is  
preferred.

--
Philip Jenvey


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Edgar Smolow  
View profile  
 More options Mar 17 2009, 3:12 pm
From: Edgar Smolow <edgarsmo...@gmail.com>
Date: Tue, 17 Mar 2009 14:12:58 -0500
Local: Tues, Mar 17 2009 3:12 pm
Subject: Re: Helpers in 0.9.7

Ok.  Now that I've got that straightened out, on to another problem. I'm
using Pylons 0.9.7 with SQLAlchemy 0.5, but running into a problem when
testing model functionality.  In particular, there's a Person object
which is supposed to be stored in
the persons table.   Here's a test code snippet:

import sqlalchemy as sa
import w2t.model as model
import w2t.model.meta as meta

DB_URL = "mysql://userid:password@localhost/dbname"

engine = sa.create_engine(DB_URL)
model.init_model(engine)
session = meta.Session()
wilma = model.Person('Wilma','Flintstone')
wilma.acct_no = 'SOMEACCOUNTNUMBER'
wilma.gender = 'F'
print 'Wilma:',wilma
session.add(wilma)
meta.Session.commit()

Since neither meta.Session or session have an add method, an
AttributeError exception is raised.  But, I don't know the correct set
of calls to make to create a session.

Thanks.
Edgar


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »