Permalink
Browse files

Don't save resources with no content. This fixes a bug where urlfetch…

…es were

failing, causing null contents to be cached such that they were not refetched.

A more elegant solution is probably necessary here in which "permanent" errors
like 404 are cached and temporary errors like an unreachable host are cached
with a timeout.

However, this change is still necessary as resources with null contents are
almost certainly always an internal error and so should not be cached.
  • Loading branch information...
1 parent d6bc3c7 commit caf136565c7884955d6fbf91730fd28632229b4e @blanu blanu committed Dec 9, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 dryapp/drydrop/app/core/vfs.py
@@ -39,7 +39,8 @@ def get_resource(self, path):
log_event("Caching resource <code>%s</code> (%d bytes)" % (path, length))
logging.debug("VFS: caching resource %s (%d bytes) for %s", path, length, domain)
resource.domain = domain
- resource.save()
+ if content!=None:
+ resource.save()
try:
length = len(resource.content)
except:

0 comments on commit caf1365

Please sign in to comment.