small script correction + correction on mutable default args
authorymh <ymh.work@gmail.com>
Fri, 02 Oct 2015 16:33:11 +0200
changeset 1451 9b146d9a7f78
parent 1450 03c0a308ccda
child 1452 9b5efbd99a14
small script correction + correction on mutable default args
.hgignore
sbin/build/compil-mdp-from-sources.sh
src/ldt/ldt/api/ldt/resources/annotation.py
--- a/.hgignore	Fri Oct 02 15:52:53 2015 +0200
+++ b/.hgignore	Fri Oct 02 16:33:11 2015 +0200
@@ -14,3 +14,4 @@
 ^\.pydevproject$
 ^\.settings/org\.eclipse\.core\.resources\.prefs$
 \.DS_Store$
+^sbin/build/mdplayer_path$
--- a/sbin/build/compil-mdp-from-sources.sh	Fri Oct 02 15:52:53 2015 +0200
+++ b/sbin/build/compil-mdp-from-sources.sh	Fri Oct 02 16:33:11 2015 +0200
@@ -1,15 +1,15 @@
+#!/usr/bin/env bash
 
-if [ $# -eq 0 ]
-  then
+set -e
+
+if [ $# -eq 0 ]; then
     echo "No argument was provided, looking for mdplayer_path"
-    if [ ! -f "mdplayer_path" ]
-      then
+    if [ ! -f "mdplayer_path" ]; then
         echo "Error: mdplayer_path file does not exist and no argument was provided"
         exit 1
     fi
     MDPLAYER_PATH=$(cat mdplayer_path)
-    if [ -z MDPLAYER_PATH ]
-      then
+    if [ -z "$MDPLAYER_PATH" ]; then
         echo "File is empty"
         exit 1
     fi
--- a/src/ldt/ldt/api/ldt/resources/annotation.py	Fri Oct 02 15:52:53 2015 +0200
+++ b/src/ldt/ldt/api/ldt/resources/annotation.py	Fri Oct 02 16:33:11 2015 +0200
@@ -12,7 +12,7 @@
 
 
 class AnnotationObject(object):
-    def __init__(self, id="", project="", type="", type_title="", ensemble="", media="", begin=0, end=0, content={"title":"", "description":""}, tags=[], meta={"creator":"", "created":""}):  # @ReservedAssignment
+    def __init__(self, id="", project="", type="", type_title="", ensemble="", media="", begin=0, end=0, content=None, tags=None, meta=None):  # @ReservedAssignment
         self.id = id
         self.project = project
         self.type = type
@@ -21,9 +21,9 @@
         self.media = media
         self.begin = begin
         self.end = end
-        self.content = content
-        self.tags = tags
-        self.meta = meta
+        self.content = content if content is None else {"title":"", "description":""}
+        self.tags = tags if tags is None else  []
+        self.meta = meta if meta is None else {"creator":"", "created":""}
 
 class AnnotationResource(Resource):
     # For the moment, these attributes are useless. We just prepare relations to AnnotationObject
@@ -315,4 +315,3 @@
 
     def get_resource_uri(self, bundle_or_obj=None, url_name='api_dispatch_list'):
         return ''
-