The Enamel class
The Enamel class defines a wrapper for the whole application. A reference to this wrapper is passed into every Nevow page object and other parts of Enamel.
The basic Enamel class is defined as follows
class Enamel(object): anonymousAccess = True vhostEnable = False storage = None authenticator = None
You must not define this yourself, but subclass it from enamel.Enamel. Other objects lend requirements to the Enamel object. For example the LDAPAuthenticator requires the instance variables ldapAuthDn, ldapBindPassword and ldapAuthUrl in the Enamel object.
The deployment module is used to start a Twisted.web instance and NevowSite? of an Enamel object.
class TestApplication(enamel.Enamel): indexPage = Index loginPage = pages.Login anonymousAccess = True authenticator = authentication.LDAPAuthenticator ldapAuthUrl = "ldap://localhost:389/dc=test,dc=co,dc=za,o=TEST?uid?sub?" ldapAuthDn = "cn=Manager, o=TEST" ldapBindPassword = "password" server = servers.TwistedWeb port = 8080 deployment.run('testApp', [ TestApplication() ])
indexPage refers to the page object which will be connected to '/' or the root of the site. The loginPage must refer to an instance of pages.Login when anonymousAccess is not set.
An authenticator has also been defined as the LDAPAuthenticator, and it's required arguments declared.
You can see above that deployment.run requires a list for it's second argument. This is because multiple sites can be defined and run inside a single process.
An inherent convenience comes from this, in that any instance variable declared inside the Enamel object will be accessible for every page, for the whole site without any extra boilerplate code.
