On Jun 5, 2011, at 1:15 AM, Tamas Hegedus wrote:

> Hi guys,
> 
> I can not get the Uploadifyer :-(
> I still do not get the picture.
> 
> I have the followings that seem OK:
> 1. myproject.template.upload
> 2. import myproject.model.widgets.uploadfiles import upload_fieldset
> 
> I have problem with the controllers and the code handling the uploads.
> I guess that the idea is that the file upload should be handled by a separate 
> controller. E.g. http:/host/myproject/upload
> 
> class UploadController:
>       ...
> 
> class RootController
>       ...
>       upload=UploadController()
> 
> ---------------
> I do not understand why the upload page is realized at the class-level in the 
> UploadController (see the code from the docs below). And why not as a 
> function of the UploadController. Or why not as a function of the 
> RootController?

Just because. It's TG2 101 - it's just the way you define URL-name-spaces. You 
don't have to, you can put everything into your single root-controller. Which 
will become messy pretty soon. But there is no technical reason not to.

So, if you feel more comfortable for now, just put the method in question into 
the root-controller. Or acquaint yourself with the TG2-way of creating 
controller-hierarchies first, with a simple demo-project, to see how things 
work.


> 
> I do not understand where the script "foobarbaz" (that handles the file 
> uploads) should be created.
> If I define it in the UploadController, I get the "No controller-wide 
> authorization at ...". I have the feeling that the file-handling-script 
> (foobarbaz) should be defined at the controller level. But what does that 
> mean?

I don' know uploadify, maybe NiL can help.

> 
> ---------------
> Moreover, this piece code of UploadController (from the docs) gives an error: 
> SyntaxError: invalid syntax (root.py, line 25)
> ???
> 
> class UploadController(BaseController):
> 
>    @expose('qpcr.templates.upload')
>    params = { 'child_args' : {       #THIS IS LINE 25
>                'upload_file': dict(script="foobarbaz"),
>                }
>              }
>    tmpl_context.file_form = upload_fieldset
>    return dict(params=params)


That one is pretty simple: you lack a "def methodname(parameters):" there.

Diez

-- 
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