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

validate proper syntax and return responses of DBaaS API calls #3

Open
adregner opened this issue Jul 9, 2012 · 3 comments
Open

validate proper syntax and return responses of DBaaS API calls #3

adregner opened this issue Jul 9, 2012 · 3 comments
Assignees
Milestone

Comments

@adregner
Copy link
Owner

adregner commented Jul 9, 2012

for alex

@ghost ghost assigned alunduil Jul 9, 2012
@alunduil
Copy link
Collaborator

clouddb.apibasemodel:

__init__

  • Without documentation I'm not sure what parent or client are in this model.
  • Why not zip kwargs and items to produce a Dict to insert items?
  • Seems too meta ... might need to hear what your design thoughts on this one were.

_load_into_self

  • Would be simpler to read with map and a set of data[k] if value isn't appropriate.

path

  • Replace if statement with getattr(self, id, self.name)

extended_items

  • return () is equivalent to the current implementation

__str__:

  • Extra options on __str__ doesn't seem right. Seems like this should be functionality the user should be implementing.

Seems strange that this class behaves like an object and as a dict. Seems simpler to provide one consistent interface than trying to merge the two. Which one makes more sense for what this is trying to accomplish?

@ghost ghost assigned adregner Jul 10, 2012
@adregner
Copy link
Owner Author

invoking "self.name" causes a lookup agains the extended_items and the api, which raises an exception for models that don't have a name property.

the str functionality is mainly for my own use in debugging and others that work on this library.

i have refactored and moved the class into clouddb.models and implemented some of the other suggestions. the outstanding issue to be addressed here still are if the data being passed into and out of the underlying API are correct and we are not missing anything. this comparison can be done against the docs (http://docs.rackspace.com/cdb/api/v1.0/cdb-devguide/content/index.html) and your own experimentation. pro tip: this "app" for chrome helps a lot: https://chrome.google.com/webstore/detail/hgmloofddffdnphfgcellkdfbfbjeloo

@alunduil
Copy link
Collaborator

What should the default be in that case? I'm inclined to say that in those cases the path might need to be implemented in that class with the special case. Otherwise, duck type it and pass back something else (or more horrifically: nest getattrs).

You should provide a __str__ method. I'm just suggesting having a static representation. I would create a debug helper for what you're currently trying to with the __str__ method.

I prefer to do my RESTful stuff with curl but I understand that the API is a bit awkward using this mechanism. I would do testing of those inputs in the unittests on the API Handler you have defined. I'll look at the testing infrastructure a bit and update the test bug with any developments.

adregner added a commit that referenced this issue Jul 12, 2012
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