Skip to content

Conversation

@rerb
Copy link
Contributor

@rerb rerb commented Feb 10, 2017

Improved

exceptions.py

security/models.py

New

membersuite_api_client.models.MemberSuiteObject. A base MemberSuite object for PortalUser and Individual.

Takes membersuite_object_data as argument.

This object data is the Zeep'ed XML representation of a concrete type of MemberSuiteObject, like PortalUser or Individual.

Takes care of converting data to a fields dictionary.

Hangs this dictionary, named fields, on self.

Sets self.id and self.extra_data.

membersuite_object_factory() in utils.py

Takes membersuite_object_data as input, returns a MemberSuiteObject.
If factory "knows" about the type of MemberSuiteObject, that specific type of MSO is returned. Otherwise, a generic MemberSuiteObject is returned. Now it only knows of PortalUser and Individual.
Usage:

import utils

membersuite_object_data = self.get_login_to_portal_response()["PortalUser"]
# Or something similar, probably more complicated, a list of string indices
# into the MemberSuite API response.

portal_user = utils.membersuite_object_factory(membersuite_object_data)

print(portal_user.get_username())

Maybe a factory is overkill, since you can make a MemberSuiteObject by simply constructing it with the appropriate Zeep object, e.g., PortalUser(membersuite_object_data).

rerb added 7 commits February 9, 2017 13:32
* Supports queries that use OBJECT() and OBJECTS().
* Command line history.
* Results best displayed for descendents of new MemberSuiteObject in
  membersuite_api_client/models.py.
* Displays errors in red.

To do

* Support for fields (rather than OBJECT(S)()) in queries.
* Display all errors, not just first one.
* Format errors for display.
* Exclude input while shelled to python (via `py` command) from
  history file.
Let's just not talk about it.
When str()'ed they'll display useful information (about the error, for
instance) rather than just the class name.
Moved into own repo, AASHE/msql-shell.
For all the Python 2/3 goodness it offers.
@coveralls
Copy link

Coverage Status

Coverage decreased (-2.8%) to 92.65% when pulling 7bbb5f9 on msql-shell into a026a46 on master.

1 similar comment
@coveralls
Copy link

coveralls commented Feb 10, 2017

Coverage Status

Coverage decreased (-2.8%) to 92.65% when pulling 7bbb5f9 on msql-shell into a026a46 on master.

@rerb rerb merged commit 52cb293 into master Feb 11, 2017
@rerb rerb deleted the msql-shell branch February 11, 2017 03:15
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

Successfully merging this pull request may close these issues.

3 participants