On 7月21日, 下午12時30分, "Julio O a" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Nice work with TG, I'm using it on some projects smothly.
>
> Today  I've upgraded to 1.0.3.2 and getting an error from Cheetah while
> quickstarting a demo.
>
> $ tg-admin quickstart
> Enter project name: testtwo
> Enter package name [testtwo]:
> Do you need Identity (usernames/passwords) in this project? [no]
> Selected and implied templates:
>   TurboGears#tgbase      tg base template
>   TurboGears#turbogears  web framework
>
> Variables:
>   egg:         testtwo
>   elixir:      False
>   identity:    none
>   package:     testtwo
>   project:     testtwo
>   sqlalchemy:  False
> Creating template tgbase
> Creating directory ./testtwo
>   Recursing into +einame+.egg-info
>     Creating ./testtwo/testtwo.egg-info/
>     Copying PKG-INFO to ./testtwo/testtwo.egg-info/PKG-INFO
>     Copying paster_plugins.txt to
> ./testtwo/testtwo.egg-info/paster_plugins.txt
>     Copying sqlobject.txt_tmpl to ./testtwo/testtwo.egg-info/sqlobject.txt
>   Recursing into +package+
>     Creating ./testtwo/testtwo/
>     Copying __init__.py_tmpl to ./testtwo/testtwo/__init__.py
>     Copying release.py_tmpl to ./testtwo/testtwo/release.py
>     Recursing into static
>       Creating ./testtwo/testtwo/static/
>       Recursing into css
>         Creating ./testtwo/testtwo/static/css/
>         Copying empty to ./testtwo/testtwo/static/css/empty
>       Recursing into images
>         Creating ./testtwo/testtwo/static/images/
>         Copying favicon.ico to ./testtwo/testtwo/static/images/favicon.ico
>         Copying tg_under_the_hood.png to
> ./testtwo/testtwo/static/images/tg_under_the_hood.png
>         Copying under_the_hood_blue.png to
> ./testtwo/testtwo/static/images/under_the_hood_blue.png
>       Recursing into javascript
>         Creating ./testtwo/testtwo/static/javascript/
>         Copying empty to ./testtwo/testtwo/static/javascript/empty
>     Recursing into templates
>       Creating ./testtwo/testtwo/templates/
>       Copying __init__.py_tmpl to ./testtwo/testtwo/templates/__init__.py
> Creating template turbogears
>   Recursing into +package+
>     Recursing into config
>       Creating ./testtwo/testtwo/config/
> /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-i686.egg/Cheetah/Compiler.py:1557:
> UserWarning: You supplied an empty string for the source!
>   warnings.warn("You supplied an empty string for the source!", )
>       Copying __init__.py_tmpl to ./testtwo/testtwo/config/__init__.py
>       Copying app.cfg_tmpl to ./testtwo/testtwo/config/app.cfg
>       Copying log.cfg_tmpl to ./testtwo/testtwo/config/log.cfg
>     Copying controllers.py_tmpl to ./testtwo/testtwo/controllers.py
>     Copying json.py_tmpl to ./testtwo/testtwo/json.py
> Traceback (most recent call last):
>   File "/usr/local/bin/tg-admin", line 7, in ?
>     sys.exit(
>   File 
> "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg/turbogears/command/base.py",
> line 389, in main
>     command.run()
>   File 
> "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg/turbogears/command/quickstart.py",
> line 203, in run
>     command.run(cmd_args)
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/command.py",
> line 210, in run
>     result = self.command()
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/create_distro.py",
> line 124, in command
>     self.create_template(
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/create_distro.py",
> line 163, in create_template
>     template.run(self, output_dir, vars)
>   File 
> "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg/turbogears/command/quickstart.py",
> line 33, in run
>     super(TGTemplate, self).run(command, output_dirs, vars)
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/templates.py",
> line 48, in run
>     self.write_files(command, output_dir, vars)
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/templates.py",
> line 116, in write_files
>     use_cheetah=self.use_cheetah)
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/copydir.py",
> line 53, in copy_dir
>     svn_add=svn_add, template_renderer=template_renderer)
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/copydir.py",
> line 61, in copy_dir
>     template_renderer=template_renderer)
>   File 
> "/usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/paste/script/copydir.py",
> line 233, in substitute_content
>     searchList=[vars])
>   File 
> "/usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-i686.egg/Cheetah/Template.py",
> line 1200, in __init__
>     self._compile(source, file, compilerSettings=compilerSettings)
>   File 
> "/usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-i686.egg/Cheetah/Template.py",
> line 1488, in _compile
>     keepRefToGeneratedCode=True)
>   File 
> "/usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-i686.egg/Cheetah/Template.py",
> line 787, in compile
>     raise parseError
> Cheetah.Parser.ParseError:
>
> Error in the Python code which Cheetah generated for this template:
> ================================================================================
>
> EOL while scanning single-quoted string
> (cheetah_DynamicallyCompiledCheetahTemplate_2007072023481224896.py, line
> 319)
>
> Line|Python Code
> ----|-------------------------------------------------------------
> 317 |
> 318 |    def _set_password(self, password):
> 319 |        ''''
>
> ^
> 320 |        algo defined in the configuration
> 321 |        ''''
> 322 |        self._password = identity.encrypt_password(password)
>
> ================================================================================
>
> Here is the corresponding Cheetah code.
> ** I had to guess the line & column numbers, so they are probably incorrect:
>
> Line 277, column 1
>
> Line|Cheetah Code
> ----|-------------------------------------------------------------
> 274 |assign(Permission, permissions_table,
> 275 |          properties=dict(groups=relation(Group,
> 276 |                secondary=group_permission_table,
> backref='permissions')))
> 277 |#else
>      ^
> 278 |#
> 279 |# identity model
> 280 |#
>
> After a little search I've found the problem on the model template, there is
> a structure like:
>
> #if
> ...
> #else if
> #if
> ...
> #else
> ...
> #end if
> #end if
>
> So what I understand from this is Cheetah doen't know to which #else if or
> #if relate the #else.
>
> Should I edit the template? what changes should be done to relate the #else
> to the inner #if?
>
> BTW the template is from the fresh install of TG by tgsetup.py.
>
> Thanks & Regards
>
> --
> Julio


Hi,

Please check if this patch[1] fixed your problem.

I tested it with cheetah 2.0rc8

[1]. http://trac.turbogears.org/changeset/3338#file2



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to