Nested attribute acccess
See original GitHub issueBrief summary of issue / Description of requested feature:
When using complex data types on object attrs, accessing nested keys/indexes would be awesome.
Steps to reproduce the issue / Reasons for adding feature:
set here/test_list = ['this', 'that', 'the other']
set here/test_list/0
Error output / Expected result of feature
Expected: Attribute Location Name/test_list/0 = this
Actual: Attribute Location Name/test_list = ['This', 'that', 'the other'] Location Name has no attribute '0'.
Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve / implement:
Looks like search_for_obj
in evennia/commands/default/building.py
would be the place to implement this chained attr lookup. Shouldn’t be too hard to implement, but would break folks expecting the multiple attr lookup, so it might need some new semantics/command.
I’m happy to attempt a PR if there is consensus on the interface.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Rails - How do you access nested params attribute?
and I want to access the user_id to change it. I tried params[:item][:user_items_attributes][0] and it doesn't work. I also tried params[:item][: ...
Read more >Creating and using nested attributes - Algolia
Nested attributes are a way of applying sub-categories to your attributes. For instance, instead of having a single searchable attribute ...
Read more >ActiveRecord::NestedAttributes::ClassMethods - Rails API
Active Record Nested Attributes Nested attributes allow you to save attributes on associated records through the parent.
Read more >Attribute-Based Access control for nested attributes
Nested attributes are a form of hierarchy, but they are most useful for organization of attribute names. Examples: user.degree.university ...
Read more >Java BeanUtils - Nested Property Access - Tutorialspoint
You can access the value of nested property of the bean by concatenating the property names of the access path by using "."...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Perfect. Yes, would have to parse and sanitize ourself, not eval. We’d probably want to check for the exact name before attempting nested access, just in case there’s an existing attribute with
[]
in the name.On Sun, Sep 15, 2019, 8:02 AM Griatch notifications@github.com wrote:
The other option is to take insert/append out completely, but then you can only add to a list by copy/pasting the value and editing, the same as today.