Skip to content

Instantly share code, notes, and snippets.

@qingfeng
Created July 30, 2008 04:01
Show Gist options
  • Save qingfeng/3222 to your computer and use it in GitHub Desktop.
Save qingfeng/3222 to your computer and use it in GitHub Desktop.
Django filter
'''
Django filter
/ 2026M 11%;/data0 107775M 0%;/tmp 2026M 3%;/usr 12186M 5%;/var 10154M 2%;/data1 138236M 0%;/data2 138236M 0%;/data3 138236M 0%
->
/ 2026M 11%
'''
@register.filte
def formatRootFSInfo(text):
if text==None:return ''
diskinfo=text.split(';')
diskinfo=filter(lambda x:x.strip()!='M',diskinfo)
if len(diskinfo)>0:
rootinfo=diskinfo[0]
return rootinfo
return " "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment