Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NoneType' object has no attribute 'now' #37

Open
jonasvp opened this issue Dec 2, 2009 · 2 comments
Open

'NoneType' object has no attribute 'now' #37

jonasvp opened this issue Dec 2, 2009 · 2 comments

Comments

@jonasvp
Copy link

jonasvp commented Dec 2, 2009

I have the weirdest bug that I've been chasing around for a couple of days now. Image-filer works on our servers but it doesn't work for me locally while developing. Python versions match and if I enable DEBUG on the server, it keeps working there. But not here.

What happens is this: when I upload a file I get the error "'NoneType' object has no attribute 'now'" in image_filer/models/init.py, line 244. Weird, since datetime gets imported fine. When I put "from datetime import datetime" right in front of that line, it works but fails at line 270 with something along the lines of "super needs a class, not None as first parameter".

Stepping through the code with pdb I notice that while in the save function, all references to earlier defined imports and classes are None! datetime is None, Image is None, everything outside of the function itself is None!

Stepping through the whole code, I notice that in all function of all classes in that init.py file all earlier imports and definitions are None - except for AbstractFile. Stepping through unicode() there, I can still access datetime, etc.

Any idea what's happening here?

Thanks,

Jonas

@jonasvp
Copy link
Author

jonasvp commented Dec 2, 2009

Just FYI: I moved the lines

if 'cms' in settings.INSTALLED_APPS:
from cms.models import CMSPlugin, Page

in models/init.py up to the top of the file, where the other imports are - and now it works. Beats me why this happened but I think it's got to do with some metaclass magic the CMS app is doing.

Cheers,

Jonas

@warper
Copy link

warper commented Jan 21, 2010

I can confirm the problem and the "solution". This is an absolutely annoying bug because it is not debuggable by a normal developer. How can datetime become None without explicit code causing that?

Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants