I think it removes the uploaded file execpt if tar because in case of
tar it is remoevd by unpack. you may want to check it. Alvaro wrote
this function.

On Dec 10, 5:32 pm, Jonathan Lundell <[email protected]> wrote:
> On Dec 10, 2009, at 3:26 PM, mdipierro wrote:
>
> > According to the docs you can generate a tar.gz using mode='w:g' but I
> > tried and it does not work on 2.5. So the process of making the w2p
> > involves a tmp step of creating a tar file that is then removed.
> > Somehow the unlink does not work on window. I do not know why. One
> > solution may be to create the tar in a temp file.
>
> This unlink is happening on the upload-and-install side, not w2p generation:
>
>     try:
>         upfile = open(upname, 'wb')
>         upfile.write(fobj.read())
>         upfile.close()
>         path = apath(app, request)
>         os.mkdir(path)
>         did_mkdir = True
>         w2p_unpack(upname, path)
>         if extension != 'tar':
>             os.unlink(upname) <<<<<<<<<<
>         fix_newlines(path)
>         return upname
>     except Exception:
>
>
>
> > On Dec 10, 4:52 pm, Jonathan Lundell <[email protected]> wrote:
> >> On Dec 10, 2009, at 2:46 PM, mdipierro wrote:
>
> >>> We may see .tar files because that is what we used before .w2p was
> >>> introduced.
>
> >>> We should only gerenate .w2p but we want to
> >>> read .tar, .tar.gz, .tgz, .w2p
>
> >>> This
>
> >>>  filename[-7:] == '.tar.gz'
>
> >>> will not cause an exception for short filenames but endswith is a
> >>> better solution.
>
> >> I see; the : saves us.
>
> >> And the .tar unlink?
>
> >>> On Dec 10, 4:37 pm, Jonathan Lundell <[email protected]> wrote:
> >>>> On Dec 10, 2009, at 2:27 PM, Yarko Tymciurak wrote:
>
> >>>>> On Dec 10, 2:12 pm, Thadeus Burgess <[email protected]> wrote:
> >>>>>> I see, Massmo, I checked my emails and I had sent you the wrong patch,
> >>>>>> it only included the fix for content-type of the admin application,
> >>>>>> instead of the logic that allows you to install an app with a .gz
> >>>>>> extension as well just in case.
>
> >>>>>> When I get home, I will send you this second part of the patch >.<
>
> >>>>>> -Thadeus
>
> >>>>> This is an excellent example of why web2py process would benefit from
> >>>>> the code-review cycle (extra eyes - even your own - are useful; we are
> >>>>> all busy, so things get missed; also the community is generally
> >>>>> "smarter" than any one of us, so additional eyes can be beneficial,
> >>>>> although limiting reviews to a small number of people has benefit).
>
> >>>> It's also an excellent example of why intentional comments are 
> >>>> desirable. I'd be happy to submit a patch to clean up the extension 
> >>>> handling. The logic is simple, and easy to fix. But I don't completely 
> >>>> understand the intent.
>
> >>>> Why were the particular extensions chosen for support? Are we really 
> >>>> likely to see an uncompressed tar file? Why does app_install() unlink 
> >>>> everything but tar files? Is it just making assumptions about what gets 
> >>>> left around in what circumstances, or is something else going on?
>
> >>>> Another problem:
>
> >>>>         elif filename[-7:] == '.tar.gz':
>
> >>>> will raise an exception for short file names, like ab.w2p. Should be 
> >>>> using endswith().
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en.


Reply via email to