Hello Jeff,

Without going and digging through code, my guess is it's trying to render
the template that is exposed for add_finish (which is None since you didn't
provide one) which is what is throwing the error.

My solution would be to use the template='enchidna.templates.machine_add"
template for add_finish and not expose add_vmware (unless you need this
exposed elsewhere), since the only two options for add_finish is a redirect
or the machine_add template anyway.

Alternatively, you could construct a URL to use the parameters you're
passing to add_vmware and pass that through redirect.

- Sam Justice

On Sun, Feb 8, 2015 at 6:39 PM, <[email protected]> wrote:

> Hello all,
>
> I am a relatively new user of TG2, and came into the project because
> changes in our campus environment finally created a problem that could not
> be fixed in a TG1/Python 2.4 based web application.
>
> The problem I've encountered is in a controller that does some silent
> processing of a form, checks some values and then forwards the user to a
> sub-form to continue adding additional information.  This worked well under
> TG1, but in TG2, the framework appears to be unable to find the template
> (template_name is set to None).
>
> The code fragment looks like this with the line that triggers the fault
> highlighted in bold in the "add_finish" function:
>
>   @expose(template="echidna.templates.machine_add")
>   def add(self, **kw):
>     return dict(page='machine_add',
>                 edit_form=forms.AddMachineFields,
>                 navigation=Markup(nav(current='add_machine', login=False)),
>                 action='/machine/add_finish',
>                 params={},
>                 defaults={})
>
>   @expose()
>   @validate(forms.AddMachineFields, error_handler=add)
>   def add_finish(self, number, provider, chartstring):
>     if provider=='IST VMware':
>       flash('Provider "%s" is supported.'%provider)
>       *return self.add_vmware(number, chartstring)*
>     else:
>       flash('Provider "%s" is not currently supported.'%provider)
>       redirect('/machine/add/')
>
>
>   @expose(template="echidna.templates.machine_add")
>   def add_vmware(self, number, chartstring):
>     params=dict(repetitions=dict(hosts=int(number)))
>     return dict(edit_form=forms.AddMachineVMWare,
>                 navigation = Markup(nav(current='add_machine',
> login=False)),
>                 action = '/machine/vmware_finish'
>                 params=params,
>                 defaults={'number':number,
>                           'chartstring':chartstring})
>
>
>
> I have a work-around that changes the add_finish into a confirmation page,
> but before commiting to adding an extra manual step in the process I am
> asking if there is a proper way to call the add_vmware function from the
> add_finish function within the TG2 framework.
>
> The specific problem report for the code above is:
>
> File "/projects/tg2env/lib/python2.6/site-packages/tg/renderers/genshi.py",
> line *196*, in get_dotted_filename
>
> if not filename.endswith(self.template_extension):
>
> AttributeError: 'NoneType' object has no attribute 'endswith'
>
> Thanks for any information or assistance.
>
> Jeff Makaiwi
> UC Berkeley
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to