← Back to team overview

pytagsfs team mailing list archive

Re: multivalued tags

 

On Mon, May 23, 2011 at 12:00:12PM -0400, Forest Bond wrote:
[...]
> The patch is not necessary.  If you want multiple values per key, you can just
> do this:
>   d = dict(xattr.get_all(path, namespace=xattr.NS_USER))
[...]

Thanks a lot, I missed it !
my code is now a bit cleaner but still not full-featured.

In fact I want to know if, in the code below,

class SimpleXAttrFile(dict):
      d = {}
      __init__(self,filename)
      __repr__(self)
      get(self, key, failobj=None)
      __setitem__(self, key, value)
      __delitem__(self, key)
      update(self, args, kwargs)
      save(self)
      items(self)

class _XattrMetaStore(MetaStore):
      get(self, path)
      set(self, path, values)
      save(self)
      extract(self, tags)
      inject(cls, tags, values)


class XattrMetaStore(_XattrMetaStore):
    error_class = Exception
    def tags_class(self, filename):
        return SimpleXAttrFile(filename)


... I should change:
    class SimpleXAttrFile(dict):

by
    class SimpleXAttrFile(Values):

or even, to remove SimpleXAttrFile and use:
   class _XattrMetaStore(MetaStore, dict):


...said differently, I still have difficulties to understand how to write
SimpleXAttrFile. (needed by pytags utility), or can (should ?) I use the
_XattrMetaStore class for both utilities ?



Raph


References