Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/addnote.py =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/addnote.py (revision 12855) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/addnote.py (revision 12856) @@ -1,29 +1,25 @@ -def addnote(md, string): +def addnote(md,string): + """ + ADDNOTE - add a note to the existing model notes field + + Usage: + md=addnote(md,string); + + Example: + md=addnote(md,'Pine Island, Geometry of 2007'); + """ - # Local Variables: md, string, i, notes, miscellaneous, newnotes - # Function calls: ischar, nargout, cell, nargin, length, addnote, error - #ADDNOTE - add a note to the existing model notes field - # - # Usage: - # md=addnote(md,string); - # - # Example: - # md=addnote(md,'Pine Island, Geometry of 2007'); - - if not isinstance(string,basetring): - print 'addnote error message: second input argument should be a string' - return [] - - notes = md.miscellaneous.notes - - if isinstance(notes,basestring): + if not isinstance(string,str): + raise TypeError('addnote error message: second input argument should be a string') + + notes=md.miscellaneous.notes + + if isinstance(notes,str): newnotes=[notes,string] - else: - newnotes=[]; - for i in range(len(notes)): - newnotes=newnotes+notes[i] - - newnotes=newnotes+nodes; - - md.miscellaneous.notes = newnotes - return md + else: + newnotes=notes.append(string) + + md.miscellaneous.notes=newnotes + + return md +