ZODB address list question (source is listed)...

Roberto Lupi Roberto at lupi.ws
Fri Jul 20 15:04:18 EDT 2001


In article <4a249347.0107120538.6cf71cba at posting.google.com>, 
bobh at hslda.org says...
> I am a newbie at both Python and ZODB so I thought I would modify the
> ZODB demo that Mr. Pelletier did. It does the Listing, Adding and 
> Quiting fine. But when I add a duplicate it does not tell me that that
> "name" is already in the database.

[cut]

> def addEmployee(name, phone):
>     if employees.has_key(name):
>         ## the below does not print when a duplicate is created
>         print "There is already an employee with this name."
>         return
>     else:
>         employees[name, phone] = Employee(name, phone)

Try:

          employees[name] = Employee(name, phone)

-- 
Roberto Lupi



More information about the Python-list mailing list