Re: simple python question

2008-08-21 Thread Thomas Kerpe
results.append({'URL': '/feed/%s/show/%s' % (item.rss, item.rssfeed),}) On Thu, Aug 21, 2008 at 23:29, Bobby Roberts <[EMAIL PROTECTED]> wrote: > > hi. > > I'm trying to figure out how to dynamically replace things in a string > as follows: > > >results.append({'URL': '/feed/%s/show/%s' (%ite

Re: Simple python question

2007-04-10 Thread Jeremy Dunck
On 4/10/07, Grupo Django <[EMAIL PROTECTED]> wrote: > > I know this is not the right place for asking about python, but it's a > simple question. > I need to load an object given in a string. Example: > > #I have a class called foo > class foo: > def Hello(): > return "Hello World" > >

Re: Simple python question

2007-04-10 Thread Todd O'Bryan
On Tue, 2007-04-10 at 17:50 -0500, Jeremy Dunck wrote: > On 4/10/07, Grupo Django <[EMAIL PROTECTED]> wrote: > > > > I know this is not the right place for asking about python, but it's a > > simple question. > > I need to load an object given in a string. Example: > > > > #I have a class called f

Re: Simple python question

2007-04-10 Thread Jeremy Dunck
On 4/10/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: ... > The key is that he wanted to use the string name of the class, not the > class itself. Assuming that Foo is available (i.e., is local to the code > you're running or has been imported), this should work: > > o = locals()['Foo']() Oh. In t

Re: Simple python question

2007-04-10 Thread Masida
This should work: class Foo: def hello(self): return "Hello World" object = Foo() print object.hello() More information: http://www.diveintopython.org/object_oriented_framework/index.html Ciao, - Matt On Apr 11, 12:22 am, "Grupo Django" <[EMAIL PROTECTED]> wrote: > I know this i

Re: Simple python question

2007-04-10 Thread Todd O'Bryan
On Tue, 2007-04-10 at 18:03 -0500, Jeremy Dunck wrote: > On 4/10/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > ... > > The key is that he wanted to use the string name of the class, not the > > class itself. Assuming that Foo is available (i.e., is local to the code > > you're running or has been

Re: Simple python question

2007-04-11 Thread Grupo Django
Thank you! What I'm doing is to load a model from a template. I have in a template something like this: {% block menu %} {% block rss %} I want to load "menu" and "rss", but I think that is too much work for now, I have no idea how to implement it and I probably won't do it. Thank you very much f

Re: Simple python question

2007-04-11 Thread mrstone
> What I'm doing is to load a model from a template. > I have in a template something like this: > {% block menu %} > {% block rss %} > > I want to load "menu" and "rss", but I think that is too much work for > now, I have no idea how to implement it and I probably won't do it. > Thank you very m