question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a way to view the last made request to the box (and sub box) objects.

See original GitHub issue
from box import Box

class test(object):
	def __init__(self, **kwargs):
		d = Box({
		'item':'value', 
		'item2': self.ok
		})
		self.d = d 

	def ok(self, **kwargs):
		print "test"
		print kwargs.keys()
		for key in kwargs.keys():
			print kwargs[key]
		return 

data={
	'test':'value',
	'test1':'value1'
}

t = test()
print t.d.item2(**data)

From t.d.item2 how do I get that path while in the ‘ok’ function.

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cdgriffithcommented, May 1, 2017

Would usage like this fulfill your need? (Testing in heritage branch, names not final at all. Thinking of maybe .box_last_action)

In [1]: from box import Box

In [2]: hearth = Box.from_json(filename="test//data//hearthstone_cards.json", tracker_box=True)

In [3]: hearth.The_Jade_Lotus.name.frFR
Out[3]: 'Le Lotus de jade'

In [4]: hearth.box_track()
Out[4]: ['The Jade Lotus', 'name', 'frFR']

In [5]: hearth.Corruption.artist
Out[5]: 'Wayne Reynolds'

In [6]: hearth.box_track()
Out[6]: ['Corruption', 'artist']
0reactions
cdgriffithcommented, Mar 11, 2020

Hi @chavenor, as an update with the new version of Box 4, it works in an entirely new method that doesn’t keep the hierarchy at all anymore, so this is no longer a realistic possibility.

If anyone else is interested in making something like this, it is probably easier to start from UserDict and apply it to that than with Box.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Collections - Box Support
To view a collection: In the left sidebar, click the name of a collection. In the preview window, Box displays the names of...
Read more >
Add a list box or combo box to a worksheet in Excel
Under Form Controls, click List box (Form Control). the list box form control button. Click the cell where you want to create the...
Read more >
best custom sub box builders
Pre-Made & Custom Subwoofer Box Plans. RTX2060. Port Area: 15. 00 FREE shipping6. 5 million ($5. Add to Cart.
Read more >
Item Modifiers in Square Online | Square Support Center - US
Text Box Label, Character Limit, and an option to make the field required. The label text is what customers will see on the...
Read more >
How to Build a Subwoofer Box | KICKER®
The purpose of an enclosure is to improve bass response and prevent woofer damage from over-excursion. There are a few things you will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found