Skip to content

Various tidy-up changes to Models, Decorators and JSON parse error handling#63

Open
kshepherd wants to merge 11 commits intothe-library-code:mainfrom
kshepherd:model_init_tidyup
Open

Various tidy-up changes to Models, Decorators and JSON parse error handling#63
kshepherd wants to merge 11 commits intothe-library-code:mainfrom
kshepherd:model_init_tidyup

Conversation

@kshepherd
Copy link
Collaborator

Client changes:

  • Keep session as an instance var in client
  • Remove unused verbose CLI option
  • Switch order of args used with do_paginate to satisfy static analysis where self as first arg is expected
  • Use direct access in Headers["Auth.."] as key was already checked
  • Always check JSON response object for None before accessing keys (this can be further improved with real error handling, but for now at least applies None checks consistently)

Model changes:

  • Simplify and improve all __init__ methods with dict get accessors and default values
  • Move class-level variables to instance where appropriate
  • Enforce type var as class level hard-coded string on all Models (justification: we have modelled the Python data model on the expected type with that label, we don't want to overwrite it with "whatever comes back from the REST API", unless checking for errors, right?)
  • Improve PyDoc by removing self-explanatory "This extends {name of superclass}" comments and adding useful URL references to DSpace Javadoc and REST contract docs
  • Add all implemented classes to the models __all__ list

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.

1 participant