Listing 4. Code that Calls Metaclass Function

# The tricky part--initializing objects from the
#   configuration global 
# `Configuration' is the top level of the object
#   tree we're going to mung 
Configuration = Controls()
copy_instance(Configuration, configuration) 
Configuration.servers = [];
for server in configuration[`servers']:
    Newsite = Server() 
    copy_instance(Newsite, server)
    Newsite.users = []; 
    for user in server['users']:
        Newuser = User() 
        copy_instance(Newuser, user)

go back to Python