Open adregner opened 12 years ago
clouddb.apibasemodel
:__init__
kwargs
and items to produce a Dict to insert items?_load_into_self
data[k]
if value isn't appropriate.path
extended_items
return ()
is equivalent to the current implementation__str__
:__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?
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
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.
for alex