Open GoogleCodeExporter opened 9 years ago
You mean if you delete a file manually from the filesystem?
I think doing the sanity check on start-up would be too long if you have a
large database. It would probably be better to do it whenever you get a list of
book files.
Original comment by andresgattinoni
on 6 Apr 2011 at 2:03
Yep, that is what I mean.. +1 to check when you get the list of book files. It
shouldn't take long to check 3 or 4 files.. :-)
Original comment by algoz...@gmail.com
on 6 Apr 2011 at 5:49
What I'm seeing is that in most places where we list files, we use a Book
object and iterate over its files. I don't know if (and how) we can override
some method of the File entity so that it does what we want whenever a book's
files are listed. Any ideas?
Original comment by andresgattinoni
on 11 Apr 2011 at 2:28
I don't quite understand the idea.. Do you mean create/override some method of
the File entity so it does the sanity checks and return a list of valid files?
Original comment by algoz...@gmail.com
on 11 Apr 2011 at 6:13
Yes, I was thinking something like that. If it's not possible we'll have to
create an ad hoc method and change the way we access to a Book's files. The
method wouldn't be hard to code, and probably now there are only a couple of
places where we would have to change the call... but it would make the code a
little less intuitive/straight-forward... so I was wondering if there was a way
to do that more transparently
Original comment by andresgattinoni
on 12 Apr 2011 at 5:08
mm.. what about having a complement method called e.g. "getValidFiles()" that
returns only the valid files and leave the other method unchanged?
Original comment by algoz...@gmail.com
on 12 Apr 2011 at 6:03
Yes, we could do that... I was just wondering if there would be a way to do it
more transparently
Original comment by andresgattinoni
on 12 Apr 2011 at 11:52
and what about a adding parameter to the current method like sanitize=True to
get only the valid file names?
Original comment by algoz...@gmail.com
on 13 Apr 2011 at 6:37
The thing is that the current method is:
book = models.Book.get_by(id=book_id)
for file in book.files:
...
My question was, precisely, what method could we override to leave that as it
is.
Original comment by andresgattinoni
on 13 Apr 2011 at 7:45
I don't know.. I'm out of ideas.. :(
Original comment by algoz...@gmail.com
on 20 Apr 2011 at 1:28
Original issue reported on code.google.com by
algoz...@gmail.com
on 24 Feb 2011 at 6:01