<s> try : <EOL> import cPickle as pickle <EOL> except ImportError : <EOL> import pickle <EOL> from django . conf import settings <EOL> from django . utils . hashcompat import md5_constructor <EOL> from django . forms import BooleanField <EOL> def security_hash ( request , form , * args ) : <EOL> """<STR_LIT>""" <EOL> data = [ ( bf . name , bf . field . clean ( bf . data ) or '<STR_LIT>' ) for bf in form ] <EOL> data . extend ( args ) <EOL> data . append ( settings . SECRET_KEY ) <EOL> pickled = pickle . dumps ( data , pickle . HIGHEST_PROTOCOL ) <EOL> return md5_constructor ( pickled ) . hexdigest ( ) </s>
