@@ -111,9 +111,6 @@ def set_default_connection(project=None, connection=None):
111111 :type connection: :class:`gcloud.storage.connection.Connection`
112112 :param connection: A connection provided to be the default.
113113 """
114- if project is None :
115- project = get_default_project ()
116-
117114 connection = connection or get_connection (project )
118115 _implicit_environ ._DEFAULTS .connection = connection
119116
@@ -141,7 +138,7 @@ def set_defaults(bucket=None, project=None, connection=None):
141138 set_default_bucket (bucket = bucket )
142139
143140
144- def get_connection (project ):
141+ def get_connection (project = None ):
145142 """Shortcut method to establish a connection to Cloud Storage.
146143
147144 Use this if you are going to access several buckets with the same
@@ -152,12 +149,15 @@ def get_connection(project):
152149 >>> bucket1 = connection.get_bucket('bucket1')
153150 >>> bucket2 = connection.get_bucket('bucket2')
154151
155- :type project: string
156- :param project: The name of the project to connect to.
152+ :type project: string or ``NoneType``
153+ :param project: Optional. The name of the project to connect to. If not
154+ included, falls back to default project.
157155
158156 :rtype: :class:`gcloud.storage.connection.Connection`
159157 :returns: A connection defined with the proper credentials.
160158 """
159+ if project is None :
160+ project = get_default_project ()
161161 implicit_credentials = credentials .get_credentials ()
162162 scoped_credentials = implicit_credentials .create_scoped (SCOPE )
163163 return Connection (project = project , credentials = scoped_credentials )
0 commit comments