Thanks a lot dear Graham. Alan On Sun, Jan 11, 2009 at 20:56, Graham Dumpleton <graham.dumple...@gmail.com>wrote:
> > Answered at: > > http://groups.google.com/group/modwsgi/browse_frm/thread/6af0cf98b726e5fe > > Graham > > On Jan 11, 11:59 pm, Alan <alanwil...@gmail.com> wrote: > > Oops, I found something. I am using apache2 + mod_wsgi and I notice that > > instead of using my Fink python ('/sw/bin/python') it's using my mac > python > > ('/usr/bin/python'). > > I compiled mod_wsgi with fink python, even though I had to put something > > like: > > > > WSGIDaemonProcess webapps user=alan group=staff processes=1 threads=16\ > > > > python-path=/sw/lib/python2.5:/sw/lib/python2.5/site-packages > > > > in my httpd.conf file. > > > > Yet, under the light of these news I still have no idea about how to > solve > > my problem. And maybe now it's a new problem: how to make apache2 + > mod_wsgi > > use fink python and not system python (for Mac in particular)? > > > > Cheers, > > Alan > > > > > > > > On Sun, Jan 11, 2009 at 12:47, Alan <alanwil...@gmail.com> wrote: > > > Hi List, > > > I have this problem now. It's about a form in my models.py that works > as > > > expected when testing with django server but when testing with apache > sever > > > (all in the same machine, mac osx leopard) it does not work as desired. > > > > > class GridJobForm(forms.Form): > > > > > file = forms.FileField(help_text="(Mandatory)") > > > > > title = forms.CharField(max_length=255, required=False, help_text= > > > "(Optional)") > > > > > def clean_file(self): > > > > > file = self.cleaned_data['file'] > > > > > print file.content_type > > > > > if len(file) > gridMaxFileSize * 1024 * 1024: #bytes > > > > > raise forms.ValidationError('File size must not exceed %s > Mb.'% gridMaxFileSize) > > > > > msg1 = 'File upload must be a valid ZIP/TGZ/BZ2 archive.' > > > > > msg2 = 'Could not unzip file.' > > > > > msg3 = 'Could not uncompress file.' > > > > > msg4 = 'Bad zip file' > > > > > #print file.content_type application/x-tar > > > > > if file.content_type == 'application/zip': > > > > > try: > > > > > zip = zipfile.ZipFile(file) #StringIO( file['content'] > ) ) > > > > > except: > > > > > raise forms.ValidationError(msg2) > > > > > bad_file = zip.testzip() > > > > > zip.close() > > > > > del zip > > > > > if bad_file: > > > > > raise forms.ValidationError(msg4) > > > > > elif file.content_type in ['application/x-gzip', > > > 'application/x-tar', 'application/octet-stream']: > > > > > try: > > > > > tarfile.open(fileobj=file) #<---- problem with apache? > > > > > except: > > > > > raise forms.ValidationError(msg3) > > > > > else: > > > > > raise forms.ValidationError(msg1) > > > > > return self.cleaned_data['file'] > > > > > It happens when I submit a tgz file to my apps under apache and the > code > > > enters in "elif file.content_type in ['application/x-gzip'...". When it > > > "try" 'arfile.open(fileobj=file)' it fails and raises msg3. > > > > > I have no idea how to debug this and can't figure out how come it > happens. > > > I tried big and small files (thinking it could be something related > > > to InMemoryUploadedFile). > > > > > I did just another thing: I removed the "try" to see what django debug > > > would report under apache and I got this: > > > > > AttributeError at /ccpngrid/ > > > > > 'NoneType' object has no attribute 'startswith' > > > > > Any help would be very appreciated. Many thanks in advance. > > > > > Cheers, > > > Alan > > > > > -- > > > Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate > > > Department of Biochemistry, University of Cambridge. > > > 80 Tennis Court Road, Cambridge CB2 1GA, UK. > > > >>http://www.bio.cam.ac.uk/~awd28<< > > > > -- > > Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate > > Department of Biochemistry, University of Cambridge. > > 80 Tennis Court Road, Cambridge CB2 1GA, UK. > > > > >>http://www.bio.cam.ac.uk/~awd28<< > > > -- Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. >>http://www.bio.cam.ac.uk/~awd28<< --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---