"Fossies" - the Fresh Open Source Software Archive

Member "cheetah3-3.2.6.post2/TODO.old" (20 Apr 2021, 12555 Bytes) of package /linux/www/cheetah3-3.2.6.post2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 NOTE: Please see https://github.com/CheetahTemplate3/cheetah3/issues
    2 for reporting bugs and feature requests.
    3 
    4 
    5 ===============================================================================
    6 ===============================================================================
    7 
    8 Desired for Cheetah 2.0
    9 =======================
   10 - Smart HTML filter that escapes all values except those individually marked as
   11   preformatted, a la Kid/PTL/QPY. (MO)
   12 
   13 
   14 TODO Items (many are just ideas. This is not an official roadmap!)
   15 ================================================================================
   16 
   17 - "cheetah test" problem: subcommands fail mysteriously on Windows.  Rewrite
   18   to avoid using subcommands.  Instead, set sys.argv and call the appropriate
   19   main() for each test.
   20 
   21 - Documentation: document #encoding.  Explain problems "cheetah test" if they
   22   haven't been fixed yet.
   23 
   24 - There's a kludge in CheetahWrapper.py to abort with a helpful error message
   25   if the user runs 'cheetah test' but doesn't have write permission in the
   26   current directory.  The tests should instead put their temporary files
   27   under the system tmp directory.
   28 
   29 - Reset the current filter to the default (or to the constructor's filter
   30   if specified) at the beginning of each fill.  Currently, filter changes
   31   leak from one fill to the next.
   32 
   33 - CheetahWrapper stuff: (MO)
   34   * "cheetah preview [options] [FILES]"  print template-specific portion of main
   35     method(s) to stdout, with line numbers based on the .py template module.
   36     Make a Template method to do the same thing, a la .generatedModuleCode().
   37   * Refactor, make compile/fill/code routines callbacks using a bundle arg.
   38   * If an input file ends in a dot, intelligently add the input extension if
   39     not found.
   40 
   41 - Debugging tools.  See section below.
   42 
   43 - Provide a utility to list the names of all placeholders in the template.
   44   Requested by Tracy Ruggles on Feb 21, 2003.
   45 
   46 - 'errorCatcher None' to stop catching errors in the middle of a template.
   47 
   48 - Utils.WebInputMixin: factor out Cheetah-specific code so it can be used in
   49   non-Cheetah applications.  Don't modify the searchList: have a Template
   50   wrapper method do that.  Consider turning it into a function that does not
   51   require 'self'.  Consider making Webware-specific code into plugins so that,
   52   e.g., other cookie-handling methods can be grafted in.  Maybe use callback
   53   classes like the planned rewrite for CheetahWrapper.  Low priority.  (MO)
   54 
   55 - Look through Zope Page Templates (TAL) for ideas to borrow.
   56   http://www.zope.org/Documentation/Books/ZopeBook/current/AppendixC.stx
   57   http://www.owlfish.com/software/simpleTAL/index.html
   58 
   59 Debugging Tools (Dump Tools)
   60 ============================
   61 It would be nice to provide debugging tools for users who can't figure
   62 out why a certain placeholder value isn't found or is being overridden.
   63 My idea is to define $dumpSearchList() and $dumpSearchListFlat() in
   64 Template, which would print a stanza in the output showing all searchList
   65 variables and their values.  $dumpSearchList would group by searchList
   66 element; $dumpSearchListFlat would combine all into a single
   67 alphabetical listing.
   68         I made an experimental version but it printed only instance variables,
   69 not methods and not inherited attributes.  Also, it wouldn't print right
   70 using the usual pattern of write-to-custom-StringIO-object-and-return-
   71 the-.getvalue() and I couldn't figure out why.
   72         The stanza should be set apart by a row of stars with the words
   73 "BEGIN/END SEARCH LIST DUMP".  Then for $dumpSearchList, precede each
   74 group with "*** searchList[i], type <element type>, 142 variables ***".
   75         Because some elements like 'self' may have hundreds of inherited
   76 methods that would create a forest-through-trees situation for the user,
   77 we may need an option to supress the variable listing for elements with
   78 > 20 variables (just print the summary line instead). ?
   79         The final version should be in Template so it has implicit
   80 access to the searchList and perhaps later to other variables (locals,
   81 globals, "#set global"s, builtins) too.  This is such a central
   82 debugging tool that you should not have to monopolize an #extends
   83 (the template's only #extends) to use it.  You could import it, however,
   84 if you pass in the searchList explicitly as an argument.  In that case,
   85 perhaps we can base it on a generic module for dumping variables/values.
   86         Note that we cannot simply depend on str() and pprint, because
   87 we need to show instances as dictionaries.  Likewise, dir() and vars()
   88 may get us part of the distance, but only if they show methods and
   89 inherited attributes too.
   90         These functions should print only top-level variables, not
   91 the subelements of collections.  I.e, if the first searchList element
   92 is a dictionary, show its keys/values, but do not expand any
   93 subvalues if they are dictionaries too, unless the display tool happens
   94 to default to that.
   95 
   96 #entry $func($arg1, $arg2="default", $**kw)
   97 ===============================================================================
   98 Make a wrapper function in the .py template module that builds a searchList
   99 from its positional arguments, then instantiates and fills a template and
  100 returns the result.  The preceding example would create a function thus:
  101         def func(arg1, arg2="default", searchList=None, **kw):
  102                 """Function docstring."""
  103                 sl = {'arg1': arg1, 'arg2': arg2}
  104                 if searchList is None:
  105                         searchList = [sl]
  106                 elif type(searchList) == types.ListType:
  107                         searchList.insert(0, sl)
  108                 else:
  109                         raise TypeError("arg 'searchList'")
  110                 t = TheTemplate(searchList=searchList, **kw)
  111                 return str(t)
  112 ##doc-entry: and #*doc-entry: comments are appended to the function docstring.
  113         Finally, make this function accessible directly from the shell.
  114 If there are any non-option arguments on the command line, call the function
  115 instead of filling the template the normal way.
  116         This would perhaps make more sense as arguments to .respond().  But
  117 .respond() has that pesky 'trans' argument that mustn't be interfered with,
  118 and other programs may assume .respond() takes only one argument.  Also,
  119 when called via str(), str() cannot take arguments.
  120 
  121 #indent
  122 ========================================================================
  123 The current indenter (which exists but is undocumented) is a kludge that has an
  124 indentation object, with implicit placeholder calls added at each line to
  125 generate the indentation, and #silent calls to adjust the object.  It should be
  126 reimplemented to generate code to call the indentation object directly.  Also,
  127 the user interface should be cleaned up, the implementation and Users' Guide
  128 synchronized, and test cases built.
  129 
  130 The desired implementation revolves around self._indenter, which knows the
  131 current indentation level (a non-negative integer), chars (the string output
  132 per level, default four spaces), and stack (the previous indentation levels).
  133 The .indent() method returns the indentation string currently appropriate.
  134 The desired interface for phase 1 (subject to change):
  135   #indent strip    ; strip leading whitespace from input lines
  136   #indent add      ; add indentation to output lines as appropriate
  137   #indent on       ; do both
  138   #indent off      ; do neither
  139   #indent reset    ; set level to 0 and clear stack
  140   #indent ++       ; increment level
  141   #indent --       ; decrement level
  142   #indent pop [EXPR]   ; revert to Nth previous level (default 1)
  143                    ; if pop past end of stack, set level to 0 and
  144                    ; clear stack.  All +/-/= operations push the old level
  145                    ; onto the stack.
  146   #indent debug    ; dump level, chars and stack to template output
  147 
  148 Possible extensions:
  149   #indent =EXPR    ; set level to N  (likely to be added to phase 1)
  150   #indent +EXPR    ; add N to level (not very necessary)
  151   #indent -EXPR    ; subtract N from level (not very necessary)
  152   #indent balance BOOL ; require all indent changes in a #def/#block to be
  153                        ; popped before exiting the method.  (difficult to
  154                        ; implement)
  155   #indent implicitPop BOOL ; automatically pop indent changes within a
  156                        ; #def/block when that method exits.  (difficult to
  157                        ; implement)
  158   #indent ??       ; a 3-way switch that combines unbalanced, balanced and
  159                    ; implicit pop.  (difficult to implement)
  160   #indent ??       ; smart stripping: strip input indentation according to
  161                    ; nested directive level; e.g.,
  162                    ; 01: #if foo=1
  163                    ; 02:     public int foo()
  164                    ; 03:     {
  165                    ; 04:       return FOO;
  166                    ; 05:     }
  167                    ; 06: #end if
  168                    ; With smart stripping, line 4 would be indented and the
  169                    ; others not.  With "on" or "strip" stripping, all lines
  170                    ; 2-5 would be unindented.  With "off" stripping,
  171                    ; lines 2-5 would not be stripped.
  172 
  173 There should be one indentation object per Template instance, shared by
  174 methods and include files.
  175 
  176 
  177 Upload File
  178 ========================================================================
  179 @@TR: This is way outside Cheetah's scope!
  180 
  181 A mixin method in Cheetah.Utils (for Template) that handles file uploads --
  182 these are too complicated for .webInput().  The method should do a "safe"
  183 file upload; e.g., http://us3.php.net/manual/en/features.file-upload.php ,
  184 within the limitations of Python's cgi module.  The user has the choice of
  185 three destinations for the file contents: (A) copied to a local
  186 path you specify, (B) placed in a namespace variable like .cgiImport()
  187 does, or (C) returned.  (B) parallels .webInput, but (A) will certainly be
  188 desirable situations where we just want to save the file, not read it into
  189 memory.  Reject files larger than a user-specified size or not in a list of
  190 user-approved MIME types.  Define appropriate exceptions for typical
  191 file-upload errors.  Method name .webUploadFileAsString?
  192         One situation to support is when  form has a text(area) field
  193 related to a file-upload control on the same form, and the user has the choice
  194 of typing into the field or uploading a text file.  We need a method that
  195 updates the text field's value if there is an uploaded file, but not if there
  196 isn't.  This may be handled by the regular method(s) or may require a separate
  197 method.
  198 
  199 RPM Building
  200 ============
  201 From: John Landahl <john@landahl.org>
  202 To: cheetahtemplate-discuss@lists.sourceforge.net
  203 Subject: [Cheetahtemplate-discuss] Building Cheetah RPMs
  204 Date: Wed, 05 Nov 2003 01:27:24 -0800
  205 
  206 If anyone is interested in building Cheetah RPMs, simply add the following
  207 lines to a file called MANIFEST.in in the Cheetah directory and you'll be
  208 able to use the "bdist_rpm" option to setup.py (i.e. "python setup.py
  209 bdist_rpm"):
  210 
  211   include SetupTools.py
  212   include SetupConfig.py
  213   include bin/*
  214 
  215 Also, I've found that using /usr/lib/site-python for add-on Python
  216 packages is much more convenient than the default of
  217 /usr/lib/pythonX/site-packages, especially when jumping back and forth
  218 between 2.2 and 2.3.  If you'd like Cheetah in /usr/lib/site-python,
  219 createa a setup.cfg with the following contents:
  220 
  221   [install]
  222   install-lib = /usr/lib/site-python
  223 
  224 Of course if you do have version specific libraries they should stay in
  225 /usr/lib/pythonX/site-packages, but Cheetah seems happy in both 2.2 and
  226 2.3 and so is a good candidate for /usr/lib/site-python.
  227 
  228 
  229 User-defined directives
  230 =======================================================================
  231 IF we decide to support user-defined directives someday, consider Spyce's
  232 interface.  Spyce uses a base class which provides generic services to
  233 custom "active tags".
  234 http://spyce.sourceforge.net/docs/doc-tag.html
  235 http://spyce.sourceforge.net/docs/doc-tag_new.html
  236 
  237 
  238 Test Suite
  239 ================================================================================
  240 - add cases that test the cheetah-compile script
  241 - add cases that test the integration with various webdev frameworks
  242 
  243 Examples
  244 ================================================================================
  245 - create some non-html code generation examples
  246   - SQL
  247   - LaTeX
  248   - form email
  249 - Template definitions in a database.  .py template modules in a
  250   database?  Caching template classes and/or instances extracted from
  251   a database.
  252 - Pickled templates?
  253