render.py

Go to the documentation of this file.
00001 from formalchemy import templates
00002 from formalchemy import FieldSet
00003 
00004 __copyright__ = """\
00005 (c). Copyright 1990-2008, Vyper Logix Corp., All Rights Reserved.
00006 
00007 Published under Creative Commons License 
00008 (http://creativecommons.org/licenses/by-nc/3.0/) 
00009 restricted to non-commercial educational use only., 
00010 
00011 See also: http://www.VyperLogix.com and http://www.pypi.info for details.
00012 
00013 THE AUTHOR VYPER LOGIX CORP DISCLAIMS ALL WARRANTIES WITH REGARD TO
00014 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
00015 FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
00016 INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
00017 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
00018 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
00019 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
00020 
00021 USE AT YOUR OWN RISK.
00022 """
00023 
00024 class HTMLTableEngine(templates.TemplateEngine):
00025     def get_filename(self, name):
00026         pass
00027     
00028     def get_template(self, name, **kw):
00029         pass
00030     
00031     def render(self, template_name, **kw):
00032         return 'It works !'
00033     
00034 class MyFieldSet(FieldSet):
00035     @staticmethod
00036     def _render(self,fieldset=None,**kwargs):
00037         pass
00038 
00039     @staticmethod
00040     def prettify(self,name):
00041         pass
00042     
00043 from formalchemy import fields
00044 from formalchemy import helpers as h
00045 from vyperlogix.classes.CooperativeClass import Cooperative
00046 
00047 ##
00048 # render a field as a text field
00049 class TextFieldRenderer(Cooperative,fields.TextFieldRenderer):
00050     def __init__(self, field):
00051         super(TextFieldRenderer, self).__init__(field)
00052     
00053     def render(self, **kwargs):
00054         kwargs['size'] = 40
00055         return h.text_field(self.name, value=self._value, maxlength=self.length, **kwargs)
00056     
00057 ##
00058 # render a field as a text field
00059 class NameFieldRenderer(Cooperative,fields.TextFieldRenderer):
00060     def __init__(self, field):
00061         super(NameFieldRenderer, self).__init__(field)
00062     
00063     def render(self, **kwargs):
00064         kwargs['size'] = 60
00065         return h.text_field(self.name, value=self._value, maxlength=self.length, **kwargs)
00066     
00067 ##
00068 # render a field as a text field
00069 class EmailAddressFieldRenderer(Cooperative,fields.TextFieldRenderer):
00070     def __init__(self, field):
00071         super(EmailAddressFieldRenderer, self).__init__(field)
00072     
00073     def render(self, **kwargs):
00074         kwargs['size'] = 60
00075         return h.text_field(self.name, value=self._value, maxlength=self.length, **kwargs)
00076     
00077 if (__name__ == '__main__'):
00078     import sys
00079     print >>sys.stdout, __copyright__
00080     print >>sys.stderr, __copyright__
00081 
00082 
00083 

© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved; If you reference this document or any part of this document you must use the citation verbatim (including the link) "© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved."

Notice: This source code contained in this document is NOT open source and is NOT being distributed as open source.

122,241 lines of code and growing...