Opened 16 years ago

Closed 16 years ago

#9075 closed (fixed)

Missing destination.close()

Reported by: bmsleight Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In page http://docs.djangoproject.com/en/dev/topics/http/file-uploads/

def handle_uploaded_file(f):
    destination = open('some/file/name.txt', 'wb+')
    for chunk in f.chunks():
        destination.write(chunk)

IMHO should read:-

def handle_uploaded_file(f):
    destination = open('some/file/name.txt', 'wb+')
    for chunk in f.chunks():
        destination.write(chunk)
        destination.close()

Regards,
Brendan

Change History (1)

comment:1 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [9027]) Fixed #9075: Added a call to close() in the example file upload handler. Thanks to Brendan (bmsleight) for the suggestion.

Note: See TracTickets for help on using tickets.
Back to Top