def create_comm_note(obj, version, author, body, note_type=comm.NO_ACTION, perms=None, attachments=None):
 perms = (perms or {})
 if (('developer' not in perms) and (note_type in comm.REVIEWER_NOTE_TYPES)):
  perms['developer'] = False
 create_perms = dict(((('read_permission_%s' % key), has_perm) for (key, has_perm) in perms.iteritems()))
 version_param = {}
 if (obj.__class__ == Webapp):
  version_param['_version'] = version
 elif (obj.__class__ == Extension):
  version_param['_extension_version'] = version
 (thread, created_thread) = obj.threads.safer_get_or_create(defaults=create_perms, **version_param)
 note = thread.notes.create(note_type=note_type, body=body, author=author, **create_perms)
 if attachments:
  create_attachments(note, attachments)
 post_create_comm_note(note)
 return (thread, note)

def create_comm_note ( obj , version , author , body , note_type = comm . NO_ACTION , perms = None , attachments = None ) : perms = ( perms or { } ) if ( ( 'developer' not in perms ) and ( note_type in comm . REVIEWER_NOTE_TYPES ) ) : perms [ 'developer' ] = False create_perms = dict ( ( ( ( 'read_permission_%s' % key ) , has_perm ) for ( key , has_perm ) in perms . iteritems ( ) ) ) version_param = { } if ( obj . __class__ == Webapp ) : version_param [ '_version' ] = version elif ( obj . __class__ == Extension ) : version_param [ '_extension_version' ] = version ( thread , created_thread ) = obj . threads . safer_get_or_create ( defaults = create_perms , ** version_param ) note = thread . notes . create ( note_type = note_type , body = body , author = author , ** create_perms ) if attachments : create_attachments ( note , attachments ) post_create_comm_note ( note ) return ( thread , note )
creates a note on an obj versions thread .