cut off reqinfo if it exceed 100 lines
authorLin Yang <lin.a.yang@intel.com>
Tue, 18 Dec 2012 02:45:18 +0000 (10:45 +0800)
committerLin Yang <lin.a.yang@intel.com>
Thu, 28 Feb 2013 07:23:25 +0000 (15:23 +0800)
Change-Id: I0e81bf1646ced6c984b667bf08b96a97a797e527

requests/mailer.py

index c8dfcaf..96dfb30 100644 (file)
@@ -248,8 +248,12 @@ def mailer(request, bs, wi, noreply_sender, ml, bccs, request_data,
 
                 logger('info', 'sending mail for %s %s' %(ev, tri['temp']))
 
-                reqinfo = _get_reqinfo(bs, rid, tri['detail?'])
-                return_dict['reqinfo'] = reqinfo
+                reqinfo = _get_reqinfo(bs, rid, tri['detail?']).splitlines()
+                # get first 100 lines if reqinfo exceed 100 lines
+                if len(reqinfo) > 100:
+                    reqinfo = reqinfo[0:100]
+                    reqinfo.append('\nPlease refer to OBS webUI for more details about this SR.')
+                return_dict['reqinfo'] = '\n'.join(reqinfo)
 
                 return_dict['To'] = request_data['git_author_email']