On Sat, 1 Jan 2005, Jacob S. wrote:
> funct = {'Add Virt':addvirt,'Remove Virt':remvirt,'More
> Stuff':more,"Extras":extra}
> def addvirt():
> pass
> def remvirt():
> pass
> def more():
> pass
Hi Jacob,
Quick gotcha note: the definition of the 'funct' dictionary has to g
Hello.
I believe it was Danny Yoo who told me about mapping functions a while
back on the list...
It goes along these lines...
funct = {'Add Virt':addvirt,'Remove Virt':remvirt,'More
Stuff':more,"Extras":extra}
def addvirt():
pass
def remvirt():
pass
def more():
pass
def extra():
On Thu, 2004-12-30 at 03:08, Alan Gauld wrote:
>
> I'm slightly confused about why you need to do this?
> You create a list of names (PROVISION_ACTIONS), then
> you add the corresponding functions to a dictionary
> by looking the names up in the globals dictionary.
> But since uyou know the na
> Thanks alot Jeff. This worked for me:
>
> formhandlers={}
> for verb,verb_desc in PROVISION_ACTIONS:
> try:
> formhandlers[verb]=globals()[verb]
> except KeyError:
> pass
I'm slightly confused about why you need to do this?
You create a list of names (PROVISION_ACTIONS), then
you add the cor
I'm not sure what exa ctly you are trying to do here,
but I'll take a guess.
> def addvirt(): pass
> def remvirt(): pass
> PROVISION_ACTIONS=[('addvirt','Add Virt'),('remvirt','Remove
Virt'),]
Not sure why you have the list of tuples of strings, but it
shouldn't be a problem.
> formhandlers={}
>
Hello,
Mohamed Lrhazi wrote:
>def addvirt():
> pass
>def remvirt():
> pass
>
>PROVISION_ACTIONS=[('addvirt','Add Virt'),('remvirt','Remove Virt'),]
>formhandlers={}
>
># this works
>formhandlers["addvirt"]=addvirt
>formhandlers["remvirt"]=remvirt
>
># this does not work:
>for verb,ver
Thanks alot Jeff. This worked for me:
formhandlers={}
for verb,verb_desc in PROVISION_ACTIONS:
try:
formhandlers[verb]=globals()[verb]
except KeyError:
pass
On Wed, 2004-12-29 at 14:37, Jeff Shannon wrote:
> If you can't make that change to PROVIS
Mohamed Lrhazi wrote:
def addvirt():
pass
def remvirt():
pass
PROVISION_ACTIONS=[('addvirt','Add Virt'),('remvirt','Remove Virt'),]
formhandlers={}
# this works
formhandlers["addvirt"]=addvirt
formhandlers["remvirt"]=remvirt
# this does not work:
for verb,verb_desc in PROVISION_ACTI
def addvirt():
pass
def remvirt():
pass
PROVISION_ACTIONS=[('addvirt','Add Virt'),('remvirt','Remove Virt'),]
formhandlers={}
# this works
formhandlers["addvirt"]=addvirt
formhandlers["remvirt"]=remvirt
# this does not work:
for verb,verb_desc in PROVISION_ACTIONS:
if cal