What to expect (and test) with Gramps 6.0 beta

My rc1 is inoperative right now.

But in beta2, the samesurnames.py QuickReport used to show the linked surnames listed in Top Surnames ( a default Dashboard gramplet) has a cascade of errors ending in AttributeError: 'SameSurname' object has no attribute 'apply_to_one'

Does this test as fixed in rc1?

Yes. It was reported as bug #13657 and fixed in pull request #1995.

1 Like

Several discussions have mentioned errors related to apply_to_one Is this going to be a recurring theme in Custom Rule filters

Here is the report when using the Active Person addon rule failed with the AIO Gramps 6.0rc1-2.

2025-03-05 12:56:45.608: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gui\filters\sidebar\_sidebarfilter.py", line 166, in clicked
    self.clicked_func()
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\plugins\gramplet\filter.py", line 78, in __filter_clicked
    self.gui.view.build_tree()
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gui\views\listview.py", line 359, in build_tree
    self.model.rebuild_data()
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gui\views\treemodels\treebasemodel.py", line 526, in rebuild_data
    self._build_data(self.current_filter, None, skip)
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gui\views\treemodels\treebasemodel.py", line 595, in _rebuild_filter
    self.__rebuild_filter(
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gui\views\treemodels\treebasemodel.py", line 626, in __rebuild_filter
    for handle in dfilter.apply(
                  ^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\_genericfilter.py", line 295, in apply
    res = self.apply_logical_op_to_all(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\_genericfilter.py", line 189, in apply_logical_op_to_all
    if apply_logical_op(db, obj, self.flist) != self.invert:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\_genericfilter.py", line 222, in and_test
    return all(rule.apply_to_one(db, data) for rule in flist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\_genericfilter.py", line 222, in <genexpr>
    return all(rule.apply_to_one(db, data) for rule in flist)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\rules\_matchesfilterbase.py", line 103, in apply_to_one
    return filt.apply_to_one(db, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\_genericfilter.py", line 244, in apply_to_one
    res = self.and_test(db, data, self.flist)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\_genericfilter.py", line 222, in and_test
    return all(rule.apply_to_one(db, data) for rule in flist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\filters\_genericfilter.py", line 222, in <genexpr>
    return all(rule.apply_to_one(db, data) for rule in flist)
               ^^^^^^^^^^^^^^^^^
AttributeError: 'IsActivePerson' object has no attribute 'apply_to_one'

It is until someone updates the addons. If you wanted to help, you could:

  1. go to GitHub - gramps-project/addons-source: Contributed 3rd party plugins for Gramps
  2. change to gramps60 branch

  1. Find the offending addon: addons-source/FilterRules/activepersonrule.py at maintenance/gramps60 · gramps-project/addons-source · GitHub
  2. Find the line that is apply() rather than apply_to_one(): addons-source/FilterRules/activepersonrule.py at maintenance/gramps60 · gramps-project/addons-source · GitHub

And then depending on your skill, either make a PR, or make a bug report.

1 Like

Thanks. A patching process is welcome. I will experiment.

BTW, that filter failure results a uncancellable filter progress bar.

Did I misread about a cancel being added for 6.0? Or do we need to apply Kari’s addon that insert one?

Yes, you misremembered. It is slated for 6.1 because it is too late for big changes in 6.0. But the fix will also allow canceling even inside a filter’s loop. No addon is going to do that.

1 Like

Ok. That fixes 1 addon rule. 11 more to check in that FilterRules addon pack and another 8 in the FilterRules2 addon pack.

They all have the same issue; you don’t need to do anything more with these two addons. But there might be others.

1 Like

Are these the same apply:

No, that is an apply() to the whole table, or a list of people (iter_persons). It used to be the case that both uses (apply to all, and apply to one) were called apply(). This one is correct.

OK… that means I’m outta my depth checking the apply instances throughout the addons-source

5 posts were split to a new topic: Addons fail to load in 6.0 [Addon Manager installs from outdated Project]

The problem is occurring because the Isotammi filter rules+ addons are trying to load “father_base” and “mother_base” from gen.filters.rules.family._memberbase which doesn’t exist any more in recent Gramps 6.0. It disappeared in the “Refactor, Fix, and optimize filters/rules” commit back on Feb 2.
Kari Kujansuu @kku will need to update his Isotammi rules to deal with this.

3 Likes

I’ve created pull request #2024 which allows Gramps to continue if an addon rule fails to load.

1 Like

Just notices a problem with some people in my tree after installing new release.

Traceback (most recent call last):
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/views/listview.py", line 1048, in _button_press
    self.edit(obj)
  File "/home/brian/Downloads/gramps-6.0.0/gramps/plugins/lib/libpersonview.py", line 468, in edit
    EditPerson(self.dbstate, self.uistate, [], person)
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/editperson.py", line 149, in __init__
    EditPrimary.__init__(
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/editprimary.py", line 100, in __init__
    self._create_tabbed_pages()
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/editperson.py", line 508, in _create_tabbed_pages
    self.event_list = PersonEventEmbedList(
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/personeventembedlist.py", line 76, in __init__
    EventEmbedList.__init__(
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/eventembedlist.py", line 127, in __init__
    GroupEmbeddedList.__init__(
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/groupembeddedlist.py", line 81, in __init__
    EmbeddedList.__init__(
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/embeddedlist.py", line 134, in __init__
    self.rebuild()
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/embeddedlist.py", line 607, in rebuild
    self.model = self.construct_model()
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/groupembeddedlist.py", line 105, in construct_model
    return self.build_model(
           ^^^^^^^^^^^^^^^^^
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/eventrefmodel.py", line 130, in __init__
    self.append(parentiter, row=self.row(index, eventref, event))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/eventrefmodel.py", line 164, in row
    self.column_place(eventref),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gui/editors/displaytabs/eventrefmodel.py", line 202, in column_place
    return place_displayer.display_event(self.db, event)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gen/display/place.py", line 84, in display_event
    return self.display(db, place, event.get_date_object(), fmt)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brian/Downloads/gramps-6.0.0/gramps/gen/display/place.py", line 96, in display
    pf = self.place_formats[fmt]
         ~~~~~~~~~~~~~~~~~~^^^^^
IndexError: list index out of range

It seems to affect about 35% of my Persons. No addons installed. Locale repaired.

I’m a little late because 6.0 has been released, but these changes have introduced a bug in my SuperTool scripts and custom filters.
SuperTool allows to use custom filters in scripts. Under the hood it uses the match function of the filter, and this has been changed to use apply_to_one . However, it seems apply_to_one doesn’t make sure that requestprepare has been called on the underlying rules. As a result, it fails (I was using IsAncestorOf and it complained about selected_handles not existing).
I am not sure where the fix should be (Gramps or SuperTool), that’s why I haven’t filed a proper bug report. My instinct as a developer is that since apply_to_one relies on the rules being prepared, it should ensure they actually are, but maybe it’s expected that developers using filters initialize them (but then I couldn’t find an obvious way of doing so, like a requestruleprepare function in the GenericFilter class or something like that).
As an experiment, I added a call to requestprepare on rules in apply_to_one. I was of course hit with “The filter definition contains a loop.” because my script called the filter more than 20 times… when commenting that, everything worked ok. It’s probably the worst way to fix it but it did confirm the source of the problem.
I can file a bug report if you want, just tell me where.

1 Like

Please create a bug report in our bug tracker.

I recall seeing an exchange between @dsblank and @kku about SuperTool scripts, rules, Gramps 6.0 and the apply_to_one issue. But I cannot locate it. (Taapeli PR50 )

Regardless of such a discussion… if the problem wasn’t raised in the Taapeli GitHub repository for Gramps add-ons, it probably did not get into their “ToDo” list. (The Gramps-project asks for issues to be filed in the MantisBT bug tracker. But there is discussion of migrating to GitHub Issues… because the MantisBT list is clogged up beyond belief.)

Information, suggestions, gripes and bug reports come from all directions. And is a major pain to cross-reference all that unstructured data.

So please submit an issue/report in their GitHub repository.

I fixed this in SuperTool by calling apply instead of match. I hope this helps.

2 Likes

I noticed the following in Gramps 6.0.
When I want to assign a date to a location, the “Select Date” window opens. The default “Type” is “Text Only.” When I change this to “From,” a message appears in the bottom left corner of the window asking "Correct the date or change from “From” to “Text Only.”
Now, when I enter a year, the OK field is grayed out. It only becomes available when I click in the “Comment on Text” field.
Can I change this default setting from “Text Only”?