GeezerVison is showing github.com — Implicit set_ methods should return the values set and raise if not successful · Issue #631 · googleapis/google-cloud-python
Implicit set_ methods should return the values set and raise if not successful #631
Description
See @tseaver comment about returning (and the current storage regression test hacky behavior).
This will likely require doing something like
class Environment(object):
....
DEFAULT_ENVIRON = Environment()
def set_default_foo():
# Do some stuff to DEFAULT_ENVIRON
return DEFAULT_ENVIRONActivity
changed the title
[-]Implict set_ methods should return the values set and raise if not successful[/-] [+]Implicit set_ methods should return the values set and raise if not successful[/+] on Feb 13, 2015dhermes commented on Mar 9, 2015
ContributorAuthor
More actions
@tseaver We currently have 7 set_ methods defined:
$ git grep -n 'def set_'
gcloud/datastore/__init__.py:65:def set_defaults(dataset_id=None, connection=None):
gcloud/datastore/_implicit_environ.py:131:def set_default_dataset_id(dataset_id=None):
gcloud/datastore/_implicit_environ.py:185:def set_default_connection(connection=None):
gcloud/storage/__init__.py:56:def set_default_bucket(bucket=None):
gcloud/storage/__init__.py:82:def set_default_project(project=None):
gcloud/storage/__init__.py:101:def set_default_connection(project=None, connection=None):
gcloud/storage/__init__.py:117:def set_defaults(bucket=None, project=None, connection=None):
$ git log -1 --pretty=%H
3c7316ee312a3255fd78aa93d136ec5b19060417
Among what we do have:
datastore._implicit_environ.set_default_dataset_id throws an exception if not set but does not return
datastore._implicit_environ.set_default_connection neither throws nor returns
datastore.__init__.set_defaults just wraps set_default_dataset_id and set_default_connection, so could get exception throwing for free but returning is not simple. We could just remove this since we have the lazy loading now.
storage.__init__.set_default_bucket neither returns nor throws
storage.__init__.set_default_project neither returns nor throws
storage.__init__.set_default_connection neither returns nor throws
storage.__init__.set_default_defaults neither returns nor throws
dhermes commented on Aug 28, 2015
ContributorAuthor
More actions
Irrelevant in Client world
Metadata
Metadata
Development
No branches or pull requestsIssue actions