[Dextrose] [PATCH] set ctime workaround

Aleksey Lim alsroot at member.fsf.org
Tue Jan 11 11:59:57 EST 2011


On Tue, Jan 11, 2011 at 11:55:51AM -0300, Martin Abente wrote:
> From: Esteban Bordon <ebordon at plan.ceibal.edu.uy>
> 
> This is a workaround to set te ctime in sugar-toolkit.

+1, in fact, ds will fix it but having ctime right after creating local
jobject will let to not fail the code that relays on ctime before writing
to ds.

> 
> ---
>  src/sugar/datastore/datastore.py |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/sugar/datastore/datastore.py b/src/sugar/datastore/datastore.py
> index 1618cef..db75665 100644
> --- a/src/sugar/datastore/datastore.py
> +++ b/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)
>  
>  
> -- 
> 1.7.1
> 
> _______________________________________________
> Dextrose mailing list
> Dextrose at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/dextrose
> 

-- 
Aleksey


More information about the Dextrose mailing list