You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am spinning up some fake data for my site using FactoryBoy/faker, including Wagtail Menus. I noticed that MenuPage objects have the has_submenu_items getter method, but I would like to programatically set this option from a python script.
I am guessing it would be a trivial fix to make the method a property instead.
If this seems plausible, i'd be happy to attempt a PR.
(maybe this is implemented in the Wagtail Menus API #302 ? )
The text was updated successfully, but these errors were encountered:
@schlich I'm not sure changing code to facilitate such a test is the best idea. Plus, making it a 'property' would not make the value settable unless you used cached_property, or added a dedicated setter method, neither of which do I think fit the design very well.
If you do need to control the method result, why not update your factory to replace the method on the instances it creates? The unittest.mock library in python core is perfect for this kind of thing.
Hi,
I am spinning up some fake data for my site using FactoryBoy/faker, including Wagtail Menus. I noticed that MenuPage objects have the
has_submenu_items
getter method, but I would like to programatically set this option from a python script.I am guessing it would be a trivial fix to make the method a property instead.
If this seems plausible, i'd be happy to attempt a PR.
(maybe this is implemented in the Wagtail Menus API #302 ? )
The text was updated successfully, but these errors were encountered: