[Dextrose] [Patch] Journal sort by creation date

Andrés Ambrois andresambrois at gmail.com
Wed Oct 13 11:57:48 EDT 2010


On Wednesday, October 13, 2010 09:37:01 am Esteban Bordon wrote:
> I attach a patch to fix Journal sort by creation date. It sets ctime=now
> when a Journal entry is created.
> 
> Index: sugar-toolkit-0.88.1/src/sugar/datastore/datastore.py
> ===================================================================
> --- sugar-toolkit-0.88.1.orig/src/sugar/datastore/datastore.py
> +++ sugar-toolkit-0.88.1/src/sugar/datastore/datastore.py
> @@ -305,6 +305,8 @@ def create():
>      metadata = DSMetadata()
>      metadata['mtime'] = datetime.now().isoformat()
>      metadata['timestamp'] = int(time.time())
> +    if not metadata.get('ctime'):
> +        metadata['ctime'] = time.strftime("%Y-%m-%dT%H:%M:%S",
> time.localtime())
>      return DSObject(object_id=None, metadata=metadata, file_path=None)

It's strange that this line is not present in Dextrose. What build is this? 
This change is present patch listed in [0].

In any case, the sorting patches were much improved in mainline (we're using a 
"creation_time" property now), maybe it would be better to cherry pick those 
commits instead of forking the development of this feature? I don't know what 
the backport/bugfix policy for Dextrose is in these cases.

This patch is correct of course, but I wonder what other stuff may be missing 
from my series...

[0] http://wiki.sugarlabs.org/go/Dextrose/TODO/Patches
(sizelist-0004-Add-ctime-property-to-the-index-and-datastore.patch)

> 
> cheers,
> Esteban.
> 
> 2010/10/13 Bernie Innocenti <bernie at codewiz.org>
> 
> > On Tue, 2010-10-12 at 13:40 -0200, Esteban Bordon wrote:
> > > Hi all.
> > >
> > > I was making a patch for Journal sort by creation date for Dextrose
> > > and I found 2 datastore.py in the OS.
> > >
> > > /usr/lib/python2.6/site-packages/sugar/datastore.py and
> > > /usr/lib/python2.6/site-packages/carquinyol/datastore.py
> > >
> > > One of those belong to sugar-toolkit and the other one belong to
> > > sugar-datastore. The second includes a patch for this issue but it
> > > doesn't shows correctly in Journal.
> > >
> > > must I to change sugar-toolkit?
> >
> > The datastore.py in sugar-toolkit is used by activities to interface
> > with the Journal (wrapping its dbus protocol). The datastore.py in
> > carquinyol is the actual datastore.
> >
> > Adding Sascha and Andres on cc, in case they want to add something.
> >
> > --
> >   // Bernie Innocenti - http://codewiz.org/
> >  \X/  Sugar Labs       - http://sugarlabs.org/
> >
> >
> 

-- 
  -Andrés
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20101013/85591340/attachment.pgp>


More information about the Dextrose mailing list