Home | Trees | Index | Help |
|
---|
Package aquarium :: Package util :: Module InternalLibrary :: Class InternalLibrary |
|
AquariumClass
--+
|
InternalLibrary
This is the "standard library" for Aquarium's structure.
Method Summary | |
---|---|
Dynamically import and instantiate a class from Aquarium. | |
This is a convenience method for aquariumFactory().__call__(). | |
Forward processing to a new screen. | |
Return s after "HTML encoding" it (i.e. | |
Iterate downward through a hierarchy calling a method at each step. | |
Prepare s for use in a JavaScript quoted string. | |
Escape s and wrap it in single quotes. | |
Do an HTTP redirect. | |
Do an HTTP redirect using HTTPResponses.SEE_OTHER. | |
Do an HTTP redirect using HTTPResponses.TEMPORARY_REDIRECT. | |
This is an alias for validModuleName. | |
Create any directories necessary and compile the template. | |
Recursively update the parent class, as necessary. | |
Find and perhaps compile a class from Aquarium. | |
Return (packagePath, moduleCompileDir). | |
Does the template need to be compiled or recompiled? | |
Inherited from AquariumClass | |
Set a reference to ctx. |
Method Details |
---|
aquariumFactory(self, moduleName, *args, **kargs)Dynamically import and instantiate a class from Aquarium. This works for templates too. In fact, this method will automatically compile templates as necessary. Because it's difficult to distinguish a compiled template from a normal Python module, you should not create both a template and a normal Python module with the same name (excluding the extension) in the same directory as many bad things can happen. I will also recursively compile base templates if you're real nice to me and use lines that look like: #extends aquarium.foo.Bar Otherwise, this is a very difficult thing to do. In fact, I'll go so far as to raise an exception if you try to extend something without using a module name that starts with "aquarium." (i.e. a module name that isn't fully specified).
|
call(self, moduleName, *args, **kargs)This is a convenience method for aquariumFactory().__call__().
If you need to pass additional arguments to aquariumFactory or if you need to call some other method than __call__, don't use this method. |
forward(self, screen, *args, **kargs)Forward processing to a new screen. This method does not return. Generate a Forward exception which aquarium.util.Aquarium.screenLoop class is prepared to catch.
|
htmlEntities(self, s)Return s after "HTML encoding" it (i.e. & -> &, etc.). I'm leaving this here just in case I have to do charset specific entity encodings. |
inverseExtend(self, boundMethod, *args, **kargs)Iterate downward through a hierarchy calling a method at each step. In a sense, this is like the object oriented concept of extending a method, except the parent class wraps the child class instead of the other way around. This method was inspired by Perl's Mason. Just as with extending a method, you can pass whatever arguments you want to "super" (although here you're passing those arguments to the subclass via callNext) and you can return whatever you want (the highest level method returns to the actual caller). If an instance has multiple superclasses, only the first is considered.
You can call this method via something like this: inverseExtend(object.method, myArg, myOtherArg) When calling the method at each step, I'll call it like this: Class.method(object, callNext, *args, **kargs) However, the lowest level class's method has no callNext parameter, since it has no one else to call: Class.method(object, *args, **kargs) In the method: callNext(*args, **kargs) should be called when it is time to transfer control to the subclass. This may even be in the middle of the method. Naturally, you don't have to pass *args, **kargs, but a common idiom is for the parent class to just receive *args and **kargs and pass them on unmodified. |
javaScriptEscape(self, s, htmlent=True)Prepare s for use in a JavaScript quoted string.
|
javaScriptQuote(self, s, htmlent=True)Escape s and wrap it in single quotes. |
redirect(self, url, httpResponse=307)Do an HTTP redirect. This method does not return.
Use this method if you must redirect to a url not on this site. In most cases, you'll want redirectSeeOther instead. (This works by doing a forward to aquarium.screen.redirect.) |
redirectSeeOther(self, screen, *args, **kargs)Do an HTTP redirect using HTTPResponses.SEE_OTHER. This is a convenience method for: import HTTPResponses url = ctx.url.screen(screen, *args, **kargs) ctx.iLib.redirect(url, HTTPResponses.SEE_OTHER) This method does not return. Sometimes you have a form (e.g. a login form), and after the user submits the form, you redirect him to some other screen within the site. That's what the HTTP response "303 See Other" is made for, and hence, that's what this method is made for. |
redirectTemporary(self, screen, *args, **kargs)Do an HTTP redirect using HTTPResponses.TEMPORARY_REDIRECT. This is a convenience method for: import HTTPResponses url = ctx.url.screen(screen, *args, **kargs) ctx.iLib.redirect(url, HTTPResponses.TEMPORARY_REDIRECT) This method does not return. Use this method instead of redirectSeeOther if you want to use a TEMPORARY_REDIRECT instead of a SEE_OTHER redirect. In most cases, you'll want redirectSeeOther instead. |
validModuleName(self, name)This is an alias for validModuleName. |
_compile(self, moduleName, templateFile, compiledTemplate, name)Create any directories necessary and compile the template. The module will also contain a new attribute, __AQUARIUM_cheetahSrc__, documenting where the original template was found. |
_compileParent(self, templateFile)Recursively update the parent class, as necessary. |
_findAndCompile(self, moduleName)Find and perhaps compile a class from Aquarium.
|
_getModuleCompileDir(self, package, parentModule, moduleTypePieces)Return (packagePath, moduleCompileDir). Make use of properties.CHEETAH_COMPILE_DIRECTORY. If it is None, moduleCompileDir will also be None. |
_needsCompiling(self, templateFile, compiledTemplate)Does the template need to be compiled or recompiled? |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 | http://epydoc.sf.net |