On Nov 20, 2007 10:24 AM, Greg <[EMAIL PROTECTED]> wrote:
> self.create(50, 50, "round")
>
> def create(self, wsize, hsize, shape):
>         var = self.get_shape_filename()
>
> In the above case I'm sending 'round' to the method.  So it's supposed
> to be get_round_filename.

Well, to be fair, it's doing what it's supposed to be doing, just not
what you want it to do. :) Try something like this instead:

def create(self, wsize, hsize, shape):
    func = getattr(self, 'get_%s_filename' % shape)
    var = func()

That will look for 'get_round_filename' if you pass in 'round', or
'get_square_filename' if you pass in 'square', etc. Hope it helps.

-Gul

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to