couchwidget throws error if record_type is set before headings

Bug #412266 reported by Rick Spencer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
desktopcouch
Undecided
Rick Spencer

Bug Description

This is the logical order to set properties on a couchwidget:
        self.couchwidget.database = "super_text"
        self.couchwidget.record_type = "http://wiki.ubuntu.com/Quickly/SuperTextDoc"
        self.couchwidget.headings = ["title"]

But this causes the error:
Traceback (most recent call last):
  File "bin/super_text", line 121, in open_file
    opener = OpenDialog.NewOpenDialog()
  File "/home/rick/super_text/super_text/OpenDialog.py", line 73, in NewOpenDialog
    dialog.finish_initializing(builder)
  File "/home/rick/super_text/super_text/OpenDialog.py", line 39, in finish_initializing
    self.couchwidget.record_type = "http://wiki.ubuntu.com/Quickly/SuperTextDoc"
  File "/home/rick/desktopcouch/desktopcouch/records/couchwidget.py", line 119, in record_type
    self.__populate_treeview()
  File "/home/rick/desktopcouch/desktopcouch/records/couchwidget.py", line 127, in __populate_treeview
    self.__reset_model()
  File "/home/rick/desktopcouch/desktopcouch/records/couchwidget.py", line 317, in __reset_model
    col_count = len(self.headings) + 1

The code must be written like this:
        self.couchwidget.database = "super_text"
        self.couchwidget.headings = ["title"]
        self.couchwidget.record_type = "http://wiki.ubuntu.com/Quickly/SuperTextDoc"

Related branches

Changed in desktopcouch:
assignee: nobody → Rick Spencer (rick-rickspencer3)
status: New → Confirmed
Changed in desktopcouch:
status: Confirmed → Fix Committed
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

The committed fix was not good. You are supposed to be able to use the couchwidget without setting the headings.

Changed in desktopcouch:
status: Fix Committed → Confirmed
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

modified the code so that couchwidget can respond flexibly depending on whether the developer has set up headings, or whether they can be inferred from existing records.

Changed in desktopcouch:
status: Confirmed → In Progress
tags: added: ubuntuone-karmic
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

I think this is fix release now

Changed in desktopcouch:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers