41 messages in com.googlegroups.pylons-discussRe: Controller name| From | Sent On | Attachments |
|---|---|---|
| Mikeroz | 22 May 2008 07:37 | |
| Mike Orr | 22 May 2008 09:31 | |
| Mel Raab | 22 May 2008 10:07 | |
| Duong Vu | 22 May 2008 10:50 | |
| Kyle Crawford | 22 May 2008 12:44 | |
| Shannon -jj Behrens | 22 May 2008 15:07 | |
| Mike Orr | 22 May 2008 15:20 | |
| Garland, Ken R | 22 May 2008 16:20 | |
| Noah Gift | 22 May 2008 17:57 | |
| Raoul Snyman | 22 May 2008 23:46 | |
| Mike Orr | 23 May 2008 00:42 | |
| Christoph Haas | 23 May 2008 01:37 | |
| Shannon -jj Behrens | 23 May 2008 01:57 | |
| Raoul Snyman | 23 May 2008 02:06 | |
| wongobongo | 23 May 2008 02:35 | |
| Ross Vandegrift | 23 May 2008 07:15 | |
| Cliff Wells | 23 May 2008 09:45 | |
| Mike Orr | 23 May 2008 11:51 | |
| Noah Gift | 23 May 2008 18:53 | |
| Antonio Beamud Montero | 28 May 2008 02:45 | |
| Christoph Haas | 28 May 2008 03:50 | |
| Antonio Beamud Montero | 28 May 2008 04:10 | |
| Christoph Haas | 28 May 2008 04:19 | |
| Antonio Beamud Montero | 28 May 2008 05:40 | |
| Mike Orr | 28 May 2008 08:30 | |
| Jonathan Vanasco | 28 May 2008 10:13 | |
| jerry | 28 May 2008 13:24 | |
| Mike Orr | 28 May 2008 14:58 | |
| Alberto Valverde | 29 May 2008 05:07 | |
| Jonathan Vanasco | 29 May 2008 21:33 | |
| Shannon -jj Behrens | 30 May 2008 09:17 | |
| Alberto Valverde | 30 May 2008 11:40 | |
| Noah Gift | 01 Jun 2008 15:15 | |
| iain duncan | 01 Jun 2008 20:30 | |
| Mateusz Haligowski | 01 Jun 2008 20:44 | |
| Mike Orr | 02 Jun 2008 11:34 | |
| Thomas G. Willis | 05 Jun 2008 07:17 | |
| Kevin G. Baker | 05 Jun 2008 08:51 | |
| Mike Orr | 05 Jun 2008 12:34 | |
| Ian Bicking | 05 Jun 2008 13:14 | |
| Florent Aide | 05 Jun 2008 13:32 |
| Subject: | Re: Controller name![]() |
|---|---|
| From: | Mike Orr (slug...@gmail.com) |
| Date: | 05/28/2008 02:58:13 PM |
| List: | com.googlegroups.pylons-discuss |
Hmm, it looks like it does it only for variables listed in the action's arguments. (In pylons.controllers.core.WSGIController._inspect_call()). I thought it did it for all routing args. So you could define your action as:
def.__before__(self, controller): # Sets c.controller c.controller = controller # Or do it again to be explicit.
--Mike
On Wed, May 28, 2008 at 1:24 PM, jerry <jerr...@gmail.com> wrote:
Hi Mike,
c.controller auto-assignment doesn't seem to be implemented in Routes1.8 --
(Pdb) list 22 def index(self): 23 import pdb; pdb.set_trace() 24 -> #c.url_for_action = 'index' (Pdb) !c.controller 16:15:01,505 DEBUG [pylons.util] No attribute called controller found on c object, returning empty string ''
Jerry
On May 28, 11:30 am, "Mike Orr" <slug...@gmail.com> wrote:
On Wed, May 28, 2008 at 3:50 AM, Christoph Haas <em....@christoph-haas.de> wrote:
Hi, Antonia...
first of all: please don't hijack threads. Start a new thread if you want to post to this list. Don't just reply to a random posting.
On Mittwoch, 28. Mai 2008, Antonio Beamud Montero wrote:
How I can get the controller name in the actual template context. For example, a site.mako template used by several controllers, I want to show the controller name with something like this:
${c.name}
It's possible or I must define a property for every controller with it's name?
The routes dictionary contains the information you are after:
request.environ['pylons.routes_dict']
You cann add a "def __before__(self)" in the lib/base.py and fill a template variable with it to be used in the templates:
c.routes = request.environ['pylons.routes_dict']
That would allows you to access the current controller's name in the template as:
${c.routes['controller']}
Actually, it's easier than that: ${c.controller}
Routing variables are automatically added to 'c'.
-- Mike Orr <slug...@gmail.com>
-- Mike Orr <slug...@gmail.com>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to pylo...@googlegroups.com
To unsubscribe from this group, send email to
pylo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---




