<s> def get_homedir ( project ) : <EOL> """<STR_LIT>""" <EOL> return str ( project . pk ) <EOL> class Choices ( object ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def as_choices ( cls ) : <EOL> from django . utils . translation import ugettext as _ <EOL> keys = [ key for key in dir ( cls ) if isinstance ( getattr ( cls , key ) , int ) and key . isupper ( ) ] <EOL> slugs = dict ( ( key , key . capitalize ( ) . replace ( '<STR_LIT:_>' , '<STR_LIT:U+0020>' ) ) for key in keys ) <EOL> choices = [ ( getattr ( cls , key ) , _ ( slugs [ key ] ) ) for key in keys ] <EOL> choices . sort ( ) <EOL> return choices <EOL> @ classmethod <EOL> def as_dict ( cls ) : <EOL> return dict ( cls . as_choices ( ) ) <EOL> @ classmethod <EOL> def as_json_choices ( cls ) : <EOL> choices = cls . as_dict ( ) <EOL> from django . utils . simplejson import dumps <EOL> return dumps ( choices ) </s>
