예제 #1
0
 def from_obj(cls, container, file_obj):
     """Create from regular info object."""
     # RFC 1123: Thu, 07 Jun 2007 18:57:07 GMT
     return cls(container,
                name=file_obj.name,
                size=file_obj.size,
                content_type=file_obj.content_type,
                last_modified=dt_from_header(file_obj.last_modified),
                obj_type=cls.choose_type(file_obj.content_type))
예제 #2
0
 def from_file_info(cls, container, info_obj):
     """Create from regular info object."""
     # RFC 8601: 2010-04-15T01:52:13.919070
     return cls(container,
                name=info_obj['name'],
                size=info_obj['bytes'],
                content_type=info_obj['content_type'],
                last_modified=dt_from_header(info_obj['last_modified']),
                obj_type=cls.choose_type(info_obj['content_type']))
예제 #3
0
 def from_file_info(cls, container, info_obj):
     """Create from regular info object."""
     # RFC 8601: 2010-04-15T01:52:13.919070
     return cls(container,
                name=info_obj['name'],
                size=info_obj['bytes'],
                content_type=info_obj['content_type'],
                last_modified=dt_from_header(info_obj['last_modified']),
                obj_type=cls.choose_type(info_obj['content_type']))
예제 #4
0
 def from_obj(cls, container, file_obj):
     """Create from regular info object."""
     # RFC 1123: Thu, 07 Jun 2007 18:57:07 GMT
     return cls(container,
                name=file_obj.name,
                size=file_obj.size,
                content_type=file_obj.content_type,
                last_modified=dt_from_header(file_obj.last_modified),
                obj_type=cls.choose_type(file_obj.content_type))
예제 #5
0
    def from_key(cls, container, key):
        """Create from key object."""
        if key is None:
            raise errors.NoObjectException

        # Get Key   (1123): Tue, 13 Apr 2010 14:02:48 GMT
        # List Keys (8601): 2010-04-13T14:02:48.000Z
        return cls(container,
                   name=key.name,
                   size=key.size,
                   content_type=key.content_type,
                   content_encoding=key.content_encoding,
                   last_modified=dt_from_header(key.last_modified),
                   obj_type=cls.type_cls.FILE)
예제 #6
0
    def from_key(cls, container, key):
        """Create from key object."""
        if key is None:
            raise errors.NoObjectException

        # Get Key   (1123): Tue, 13 Apr 2010 14:02:48 GMT
        # List Keys (8601): 2010-04-13T14:02:48.000Z
        return cls(container,
                   name=key.name,
                   size=key.size,
                   content_type=key.content_type,
                   content_encoding=key.content_encoding,
                   last_modified=dt_from_header(key.last_modified),
                   obj_type=cls.type_cls.FILE)