Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added another MIME type for directory detection #5

Merged
merged 2 commits into from

2 participants

@SecurityForUs

Per OpenStack documents here: http://docs.openstack.org/trunk/openstack-object-storage/developer/content/pseudo-hierarchical-folders-directories.html

To take advantage of this feature, the directory marker objects must also be created to represent the appropriate directories. The following additional objects need to be created. A good convention would be to create these as zero- or one-byte files with a Content-Type of application/directory.

I left in the original MIME type for backwards-compatibility, but "application/directory" is the standard, and it's also how it's shown via the OpenStorage control panel.

@CrackerJackMack

Good catch! I reviewed the merge and it appears that the appropriate mime-type is used when creating directories, just not in the is_dir() function. If you could fix the doc block along with it, I will merge this ASAP.

@SecurityForUs

Per your request I fixed the doc page and I also modified the comment block in the function as well.

@CrackerJackMack CrackerJackMack merged commit 076fdb9 into softlayer:master
@CrackerJackMack

Perfect thanks! Wanted to be sure you got credit for the whole fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +2 −2 docs/build/html/object.html
  2. +2 −2 object_storage/storage_object.py
View
4 docs/build/html/object.html
@@ -129,7 +129,7 @@
<dl class="method">
<dt id="object_storage.storage_object.StorageObject.is_dir">
<tt class="descname">is_dir</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/object_storage/storage_object.html#StorageObject.is_dir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#object_storage.storage_object.StorageObject.is_dir" title="Permalink to this definition">¶</a></dt>
-<dd><p>returns True if content_type is &#8216;text/directory&#8217;</p>
+<dd><p>returns True if content_type is &#8216;text/directory&#8217; or &#8216;application/directory&#8217;</p>
</dd></dl>
<dl class="method">
@@ -356,4 +356,4 @@
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
</div>
</body>
-</html>
+</html>
View
4 object_storage/storage_object.py
@@ -177,8 +177,8 @@ def _formatter(res):
return self.client.make_request('GET', [self.container], params=params, formatter=_formatter)
def is_dir(self):
- """ returns True if content_type is 'text/directory' """
- return self.model.content_type == 'text/directory'
+ """ returns True if content_type is 'text/directory' or 'application/directory' """
+ return self.model.content_type in ['text/directory', 'application/directory']
def set_metadata(self, meta):
""" Sets metadata for the object
Something went wrong with that request. Please try again.