[Dextrose] [Patch] Journal sort by creation date

Esteban Bordon ebordon at plan.ceibal.edu.uy
Wed Oct 13 07:37:01 EDT 2010


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)



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/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20101013/a53d8d02/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sort-by-creation-date.patch
Type: application/octet-stream
Size: 603 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20101013/a53d8d02/attachment.obj>


More information about the Dextrose mailing list