[Django] #20604: Managing Files File code example opens file in write-mode, should open in read-mode

3 views
Skip to first unread message

Django

unread,
Jun 14, 2013, 5:25:54 PM6/14/13
to django-...@googlegroups.com
#20604: Managing Files File code example opens file in write-mode, should open in
read-mode
-----------------------------------------------+--------------------
Reporter: Chris Lasher <chris.lasher@…> | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------------------+--------------------
In the second code example in the
[https://docs.djangoproject.com/en/1.5/topics/files/#the-file-object
Managing Files documentation on the File object], the file
/tmp/hello.world is shown as being opened in write-mode, but it should
actually be opened in read mode. Write-mode would destroy the contents of
the file.

In other words, please change this
{{{
# Create a Python file object using open() and the with statement
>>> with open('/tmp/hello.world', 'w') as f:
>>> myfile = File(f)
...
}}}

to this
{{{
# Create a Python file object using open() and the with statement
>>> with open('/tmp/hello.world') as f:
>>> myfile = File(f)
...
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20604>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 14, 2013, 9:29:13 PM6/14/13
to django-...@googlegroups.com
#20604: Managing Files File code example opens file in write-mode, should open in
read-mode
-------------------------------------------+----------------------------

Reporter: Chris Lasher <chris.lasher@…> | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.5
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------------+----------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a1122e14a6d2ace8907923507e7d31c44a6f7c68"]:
{{{
#!CommitTicketReference repository=""
revision="a1122e14a6d2ace8907923507e7d31c44a6f7c68"
Fixed #20604 - Fixed file example in docs.

Thanks Chris Lasher for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20604#comment:1>

Django

unread,
Jun 14, 2013, 9:29:43 PM6/14/13
to django-...@googlegroups.com
#20604: Managing Files File code example opens file in write-mode, should open in
read-mode
-------------------------------------------+----------------------------

Reporter: Chris Lasher <chris.lasher@…> | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.5
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------------+----------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"e411e9931272cd22247095fc2af8d26d58eeddd6"]:
{{{
#!CommitTicketReference repository=""
revision="e411e9931272cd22247095fc2af8d26d58eeddd6"
[1.5.x] Fixed #20604 - Fixed file example in docs.

Thanks Chris Lasher for the report.

Backport of a1122e14a6 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20604#comment:2>

Reply all
Reply to author
Forward
0 new messages