mdsol / rwslib

Provide a (programmer) friendly client library to Rave Web Services (RWS).
MIT License
31 stars 13 forks source link

Not returning the specify value #116

Closed champ16 closed 3 years ago

champ16 commented 3 years ago

for any Other,specify value rwslib is not returning the specify content, it's only returning the coded value under item_value. However, specify is present as an attribute in item. Am I doing something wrong?

iansparks commented 3 years ago

Hi @champ16 when you say "rwslib is not returning" what RWS endpoint are you using (i.e. what request type) or are you talking about builders creating ODM structure?

champ16 commented 3 years ago

It's for audit API. "from rwslib.extras.audit_event.main import ODMAdapter". Audit APIs XML response has "SpecifyValue" present for any dictionary associated datapoint and specify is true(checked). This SpecifyValue is not being fetched after the parsing using above library.

I checked the library code and found out that Specify value is not being captured under Item object. I added it into my installed library and worked perfectly fine. This will serve my purpose.

What I am wondering is if you make some upgrade in future, which does not include it then I have to update the library after every upgrade.

Would you mind releasing a newer version with this change. In case you are considering you can include SignatureBroken attribute of Item tag as well.

iansparks commented 3 years ago

Hi @champ16 thanks for the clarification and I'm glad you were able to work it out. I won't ask you to make a pull request but if you want to provide the snippets of code you used we will be interested in incorporating into a future version.

champ16 commented 3 years ago

Below are the update:

  1. Under context.py

    class Item(ContextBase): def init(self, oid, value, specify_value, signature_broken, freeze, verify, lock, transaction_type): self.oid = oid self.value = value self.specify_value = specify_value self.signature_broken = signature_broken self.freeze = freeze self.verify = verify self.lock = lock self.transaction_type = transaction_type

  2. Under parser.py

attributes

A_SPECIFY_VALUE = mdsol('SpecifyValue') A_SIGNATURE_BROKEN = mdsol('SignatureBroken')

class ODMTargetParser(object): elif tag == E_ITEM_DATA: self.context.item = Item( attrib.get(A_ITEM_OID), attrib.get(A_VALUE), attrib.get(A_SPECIFY_VALUE), attrib.get(A_SIGNATURE_BROKEN), yes_no_none(attrib.get(A_FREEZE)), yes_no_none(attrib.get(A_VERIFY)), yes_no_none(attrib.get(A_LOCK)), attrib.get(A_TRANSACTION_TYPE)

Update are in bold.

glow-mdsol commented 3 years ago

Thanks - added these to bug/issue_116 branch - just going to write some test code

iansparks commented 3 years ago

Thanks @champ16 and @glow-mdsol !

glow-mdsol commented 3 years ago

One point of clarification, the SignatureBroken is a YesNoRave type so should probably be a bool - I've migrated to using that.

champ16 commented 3 years ago

Yes, Absolutely. Thank you so much @glow-mdsol for upgrading it so quickly. Much appreciated. Shall I close this issue now. Thanks @iansparks

champ16 commented 3 years ago

I will wait for @iansparks review before closing it.

glow-mdsol commented 3 years ago

I think we're good to close here