Re: [Tutor] Determine Filetype

2009-09-20 Thread ad...@gg-lab.net
Thankyou guys. > The search feature of the web site is quite effective! :-) Alan, i know that every site has a search function, but they're not so simple to be used if you're looking for a very common word ("in") and don't know other keys to find it. Regards, Giorgio

Re: [Tutor] Determine Filetype

2009-09-19 Thread ad...@gg-lab.net
2009/9/19 Sander Sweers : > On Sat, 2009-09-19 at 17:20 +0200, ad...@gg-lab.net wrote: >> I want to check the extension of an uploaded file. So i've created a >> list with allowed extensions: >> >> enabled_ext = ['gif', 'jpeg', 'png',

Re: [Tutor] Determine Filetype

2009-09-19 Thread ad...@gg-lab.net
if file_ext in enabled_ext Found an example some seconds ago in another mailing lists. I'm not able to find the python tutorial that describes this statement. Can you help me please? 2009/9/19 ad...@gg-lab.net : > Ops, i have another question, it seems very simple. > > I wan

Re: [Tutor] Determine Filetype

2009-09-19 Thread ad...@gg-lab.net
check if the file ext (file_ext) is in the list? I've searched in the python tutorial, but have not been able to find any example that uses an if statement combined with a list. Thankyou again 2009/9/19 ad...@gg-lab.net : > Hi All, > > the solution was in the link i've poste

Re: [Tutor] Determine Filetype

2009-09-19 Thread ad...@gg-lab.net
Hi All, the solution was in the link i've posted before. If i use: type = imghdr.what('img.test', image.data) The imghdr modules ignore the filename (first argument) and takes the second as a data stream assumed to contain the filetype. The solution only works for images, but that's what i need

Re: [Tutor] Determine Filetype

2009-09-18 Thread ad...@gg-lab.net
ht? Maybe i'm doing something wrong. Thankyou 2009/9/18 ad...@gg-lab.net : > Oh, i'm sorry. > > I've read the README, but haven't noticed that > > m.from_buffer(open("testdata/test.pdf").read(1024)) > > was exactly what i was looking for. > >

Re: [Tutor] Determine Filetype

2009-09-18 Thread ad...@gg-lab.net
Oh, i'm sorry. I've read the README, but haven't noticed that m.from_buffer(open("testdata/test.pdf").read(1024)) was exactly what i was looking for. Ok, i'll try it and let you know :D 2009/9/18 Kent Johnson : > On Fri, Sep 18, 2009 at 2:21 PM, ad.

Re: [Tutor] Determine Filetype

2009-09-18 Thread ad...@gg-lab.net
05 AM ad...@gg-lab.net said... >> >> Hi, >> >> i'm putting file in a DB as BLOB entries. To serve them, i need to >> take Content-Type headers. >> >> So, i'm looking for a function that returnes the filetype, given a data >> str. >> &

[Tutor] Determine Filetype

2009-09-18 Thread ad...@gg-lab.net
Hi, i'm putting file in a DB as BLOB entries. To serve them, i need to take Content-Type headers. So, i'm looking for a function that returnes the filetype, given a data str. I've found many other topics like this in python mail-archive, but any of them contains the solution. Can you help me, p

Re: [Tutor] Still Trying to Understand GAE

2009-09-17 Thread ad...@gg-lab.net
Johnson : > On Thu, Sep 17, 2009 at 8:38 AM, ad...@gg-lab.net wrote: >> Thankyou all, you're very precious for me. >> >> yeah it seems the development webserver (and the production one) are >> importing modules in a non-standard way. >> >> I abs

Re: [Tutor] Still Trying to Understand GAE

2009-09-17 Thread ad...@gg-lab.net
Giorgio 2009/9/16 Kent Johnson : > On Sun, Sep 13, 2009 at 9:59 AM, ad...@gg-lab.net wrote: >> Hi All, >> >> i've started earning python sone months ago (on Google App Engine >> unfortunately). >> >> I have some doubts reagrding "import", and ha

Re: [Tutor] Still Trying to Understand GAE

2009-09-15 Thread ad...@gg-lab.net
Hi Wesley! Thankyou very much for your mail (and i'd like to thankyou in a special way for your corrections :) ). > it imports all sub*packages*. don't think directories because the > import mechanism doesn't work this way. this is likely because there > are __init__.py files in those subdirector

[Tutor] Still Trying to Understand GAE

2009-09-13 Thread ad...@gg-lab.net
Hi All, i've started earning python sone months ago (on Google App Engine unfortunately). I have some doubts reagrding "import", and have asked a similar question here months ago, but without finding a solution. So: with import i can import modules or single functions. And this is ok. Then: as