#NEWLINE# @ internationalizeDocstring #NEWLINE# def search( self , irc , msg , args , user , optlist , globs ) : #NEWLINE# #INDENT# '[--{regexp} <value>] [<glob> <glob> ...]\n\n        Searches your todos for tasks matching <glob>.  If --regexp is given,\n        its associated value is taken as a regexp and matched against the\n        tasks.\n        ' #NEWLINE# if ( ( not optlist ) and ( not globs ) ) : #NEWLINE# #INDENT# raise callbacks . ArgumentError #NEWLINE# #UNINDENT# criteria = [ ] #NEWLINE# for ( option , arg ) in optlist : #NEWLINE# #INDENT# if ( option == 'regexp' ) : #NEWLINE# #INDENT# criteria . append ( ( lambda s : regexp_wrapper ( s , reobj = arg , timeout = 0.1 , plugin_name = self . name ( ) , fcn_name = 'search' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# for glob in globs : #NEWLINE# #INDENT# glob = utils . python . glob2re ( glob ) #NEWLINE# criteria . append ( re . compile ( glob ) . search ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# tasks = self . db . select ( user . id , criteria ) #NEWLINE# L = [ format ( '#%i: %s' , t . id , self . _shrink ( t . task ) ) for t in tasks ] #NEWLINE# irc . reply ( format ( '%L' , L ) ) #NEWLINE# #UNINDENT# except dbi . NoRecordError : #NEWLINE# #INDENT# irc . reply ( _ ( 'No tasks matched that query.' ) )