[ wxwindows-Bugs-1752674 ] wx.py.buffer.Buffer and its attribute 'confirmed'

SourceForge.net noreply at sourceforge.net
Sat Mar 15 11:44:00 PDT 2008


Bugs item #1752674, was opened at 2007-07-12 16:31
Message generated for change (Comment added) made by tibonihoo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1752674&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxPython specific
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Benjamin Longuet (benjlgt)
Assigned to: Robin Dunn (robind)
Summary: wx.py.buffer.Buffer and its attribute 'confirmed'

Initial Comment:
When using the module editor from the Py package, it is impossible to save a buffer with no assigned file to an existing file.

This bug can be reproduced by executing pyalacarte and successively selecting File->New, File->Save as, an existing file in the file dialog box and clicking on the 'Replace' button when it is asked to confirm overwriting the file. Then the action is not performed and the following exception is raised :

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/py/frame.py", line 349, in OnFileSaveAs
    self.bufferSaveAs()
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/py/editor.py", line 226, in bufferSaveAs
    self.buffer.saveAs(result.path)
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/py/buffer.py", line 102, in saveAs
    self.save()
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/py/buffer.py", line 90, in save
    if not self.confirmed:
AttributeError: Buffer instance has no attribute 'confirmed'

By looking at the code, we can see that indeed, the attribute 'confirmed' is not created in the Buffer's 'open' method when called with parameter filename=None. As well as in Buffer's 'save' method since the attribute 'filepath' of the Document instance corresponds, in that case, to an existing file.

Is the Buffer's attribute 'confirmed' relevant ?


----------------------------------------------------------------------

Comment By: Thibauld (tibonihoo)
Date: 2008-03-15 19:44

Message:
Logged In: YES 
user_id=1865508
Originator: NO

Same problem here (wx.__version__ = '2.8.4.0'), if I get it right about
the confirmed attribute, a possible resolution of this bug could consist in
replacing the following line in buffer.py (l:88):

if not os.path.exists(filepath):
    self.confirmed = True

by something like:

self.confirmed = False
if not os.path.exists(filepath):
    self.confirmed = True



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1752674&group_id=9863




More information about the wx-dev mailing list