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

Problem: Cannot generate EVENTS through member variables #43

Open
ross-spencer opened this issue Apr 5, 2018 · 1 comment
Open

Problem: Cannot generate EVENTS through member variables #43

ross-spencer opened this issue Apr 5, 2018 · 1 comment

Comments

@ross-spencer
Copy link
Contributor

ross-spencer commented Apr 5, 2018

Hi Joel,

Looking for clarification on how to write PREMIS events using this. If I try the following:

ev = premisrw.PREMISEvent()
ev.event_type = "AM CAMP DEMO"
ev.event_outcome_detail = "SUCCESS"
ev.event_outcome_detail_note = "dag iedereen!"
ev.linking_agent_identifier_type = "python script"
ev.linking_agent_identifier_value = "1.0"
print ev.generate_data

Then the default values for the object are output and no more:

<bound method PREMISEvent.generate_data of ('event', 
    {'xsi:schema_location': 'info:lc/xmlns/premis-v2 http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd', 'version': '2.2'}, 
    ('event_identifier', ('event_identifier_type', 'UUID'), 
    ('event_identifier_value', 'aa4f20ef-678e-4b07-9bb6-0f875930ddaa')), 
    ('event_date_time', '2020-09-03T14:44:33'))>

I am currently only able to create an event object and output it to XML by creating a tuple using the technique outlined here.

I guess, am I missing something?

@jrwdunham
Copy link
Contributor

Hey @ross-spencer,

Yeah, we haven't implemented PREMIS element creation via attribute setting yet. I guess that would mean implementing __setattr__. It would probably be a good idea to implement what you suggest, we just haven't done it yet.

For now, when creating a new PREMISElement (or subclass), you have to either supply the values on initialization or supply a single tuple to the data kwarg:

>>> ev = premisrw.PREMISEvent(
...     identifier_value='1665f868-dff5-4e66-8a32-f38ad7582309',
...     ...)
>>> ev = PREMISEvent(data=('event', {...}, (...)))

See

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants