I don't know a tremendous amount about how user authentication works in Zope, but my assumption is that when you login, say by going to /manage, it returns a cookie of some sort that marks you as authenticated and contains an id to identify who you are authenticated as. How would I provide this functionality in a script of my own making?
The standard Zope user folder uses HTTP Basic Authentication and no cookies. You cannot "wrap" this in a script as you propose, it is not possible. You should select a different user folder (see zope.org) that uses cookies or use a user folder in conjunction with the CookieCrumbler product to add the cookie functionality. Then you can have regular login pages. Some of the user folders allow you to have additional data on the user as well. jens