zephyr_mirror: Hack to try to eliminate fixed withs of zephyrs.

(imported from commit 58a26863e77d4bbfca3f7b488c008b7e6a4804f3)
This commit is contained in:
Tim Abbott 2012-09-11 10:50:38 -04:00
parent a983276b16
commit de0255d651
1 changed files with 12 additions and 1 deletions

View File

@ -69,6 +69,17 @@ if __name__ == '__main__':
while True:
notice = zephyr.receive(block=True)
zsig, body = notice.message.split("\x00", 1)
lines = body.split('\n')
newbody = ""
for i in range(0, len(lines)):
if (i + 1 == len(lines) or
lines[i].strip() == '' or
lines[i+1].strip() == ''):
newbody += lines[i] + "\n"
else:
newbody += lines[i] + " "
if notice.cls not in subs_list:
continue
zeph = { 'type' : 'class',
@ -77,7 +88,7 @@ if __name__ == '__main__':
'class' : notice.cls,
'instance' : notice.instance,
'zsig' : zsig, # logged here but not used by app
'new_zephyr': body }
'new_zephyr': newbody }
for k,v in zeph.items():
zeph[k] = cgi.escape(v)