Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method Entity.as_dict(). #44

Merged
merged 1 commit into from Feb 12, 2018
Merged

Add a method Entity.as_dict(). #44

merged 1 commit into from Feb 12, 2018

Conversation

RKrahl
Copy link
Member

@RKrahl RKrahl commented Feb 12, 2018

It may occasionally be convenient to get a mapping with an entity object's attributes. For instance, one may do nice things like string formatting:

>>> inv
(investigation){
   createId = "simple/root"
   createTime = 2018-02-05 11:30:14+00:00
   id = 3
   modId = "simple/root"
   modTime = 2018-02-05 11:30:14+00:00
   endDate = 2012-08-06 01:10:08+00:00
   name = "12100409-ST"
   startDate = 2012-07-26 15:44:24+00:00
   title = "NiO SC OF1 JUH HHL"
   visitId = "1.1-P"
 }
>>> "%(name)s-%(visitId)s" % inv.as_dict()
'12100409-ST-1.1-P'

@RKrahl RKrahl merged commit ef4c99d into master Feb 12, 2018
@RKrahl RKrahl deleted the entity-dict branch February 12, 2018 10:17
@RKrahl RKrahl added the enhancement New feature or request label Feb 12, 2018
@RKrahl RKrahl added this to the 0.14.0 milestone Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants