In that case, you'd want: BADWORDS = re.compile(r'ass|jerk|otherbadword|etc')
or if you already have a list or want to use the list in other places: badlist = ['ass', 'jerk', 'etc'] BADWORDS = re.compile(r'|'.join(badlist)) Anthony On Wednesday, August 15, 2012 11:22:21 AM UTC-4, Rob_McC wrote: > > thanks once again. > > -1- > I'll move to a module as you suggested. > > -2- > > The code is just the .py file (below), > To test out, I just through it in *layout.html* > > {{=IS_BAD()('badass')}} > </hr> > > > Here is badword.py, from post above > > import base64, re > BADWORDS=re.compile(base64.b64decode( > """KGFob2xlfGFudXN8YXNoMGxlfGFzaDBsZXN8YXNob2xlc3xhc3N8YXNzfGFzc2ZhY2V8YXNzaDBsZXxhc3NoMGxlenxhc3Nob2xlfGFzc2hvbGVzfGFzc2hvbHp8YXNzd2lwZXxhenpob2xlfGJhc3N0ZXJkc3xiYXN0YXJkfGJhc3RhcmRzfGJhc3RhcmR6fGJhc3RlcmRzfGJhc3RlcmR6fGJpYXRjaHxiaXRjaHxiaXRjaGVzfGJsb3d8am9ifGJvZmZpbmd8YnV0dGhvbGV8YnV0dHdpcGV8YzBja3xjMGNrc3xjMGt8Y2FycGV0fG11bmNoZXJ8Y2F3a3xjYXdrc3xjbGl0fGNudHN8Y250enxjb2NrfGNvY2toZWFkfGNvY2staGVhZHxjb2Nrc3xjb2Nrc3Vja2VyfGNvY2stc3Vja2VyfGNyYXB8Y3VtfGN1bnR8Y3VudHN8Y3VudHp8ZGlja3xkaWxkMHxkaWxkMHN8ZGlsZG98ZGlsZG9zfGRpbGxkMHxkaWxsZDBzfGRvbWluYXRyaWNrc3xkb21pbmF0cmljc3xkb21pbmF0cml4fGR5a2V8ZW5lbWF8ZmFnfGZhZzF0fGZhZ2V0fGZhZ2cxdHxmYWdnaXR8ZmFnZ290fGZhZ2l0fGZhZ3N8ZmFnenxmYWlnfGZhaWdzfGZhcnR8ZmxpcHBpbmd8dGhlfGJpcmR8ZnVja3xmdWNrZXJ8ZnVja2lufGZ1Y2tpbmd8ZnVja3N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rdXxtdXNjaGl8bmF6aXN8bmVwZXNhdXJpb3xuaWdnZXIoZXN8cyk/fG9yb3NwdXxwYXNrYShlc3xzKT98cGVyc2V8cGlja2F8cGllcmRvbChlc3xzKT98cGlsbHUoZXN8cyk/fHBpbW1lbHxwaXNzKGVzfHMpP3xwaXpkYXxwb29udHNlZXxwb29wfHBvcm58cDBybnxwcjBufHByZXRlZW58cHVsYXxwdWxlfHB1dGF8cHV0b3xxYWhiZWh8cXVlZWYoZXN8cyk/fHJhdXRlbmJlcmd8c2NoYWZmZXJ8c2NoZWlzcyhlc3xzKT98c2NobGFtcGV8c2NobXVja3xzY3Jld3xzaCF0KGVzfHMpP3xzaGFybXV0YXxzaGFybXV0ZXxzaGlwYWx8c2hpenxza3JpYnp8c2t1cnd5c3lufHNwaGVuY3RlcnxzcGljfHNwaWVyZGFsYWp8c3Bsb29nZXxzdWthfGIwMGIoZXN8cyk/fHRlc3RpY2xlKGVzfHMpP3x0aXR0KGVzfHMpP3x0d2F0fHZpdHR1fHdhbmsoZXN8cyk/fHdldGJhY2soZXN8cyk/fHdpY2hzZXJ8d29wKGVzfHMpP3x5ZWR8emFib3VyYWgp""" > )) > > class IS_BAD: > def __init__(self,error_message='We do not take S**t'): > self.error_message = error_message > def __call__(self,value): > if BADWORDS.match(value): > return (value,self.error_message) > return (value, None) > > if __name__=='__main__': > print IS_BAD()('ass') > > > > --