<s> from __future__ import unicode_literals <EOL> from json import dumps <EOL> import sh <EOL> from django . conf import settings <EOL> from django . template import Context , Library <EOL> from django . template . loader import get_template <EOL> import mayan <EOL> from . . utils import return_attrib <EOL> register = Library ( ) <EOL> try : <EOL> BUILD = sh . Command ( '<STR_LIT>' ) . bake ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> DATE = sh . Command ( '<STR_LIT>' ) . bake ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> except sh . CommandNotFound : <EOL> BUILD = None <EOL> DATE = None <EOL> @ register . filter <EOL> def get_encoded_parameter ( item , parameters_dict ) : <EOL> result = { } <EOL> for attrib_name , attrib in parameters_dict . items ( ) : <EOL> result [ attrib_name ] = return_attrib ( item , attrib ) <EOL> return dumps ( result ) <EOL> @ register . filter <EOL> def object_property ( value , arg ) : <EOL> return return_attrib ( value , arg ) <EOL> @ register . assignment_tag <EOL> def project_description ( ) : <EOL> return getattr ( settings , '<STR_LIT>' , mayan . __description__ ) <EOL> @ register . simple_tag <EOL> def project_name ( ) : <EOL> return settings . PROJECT_TITLE <EOL> @ register . simple_tag <EOL> def project_website ( ) : <EOL> return settings . PROJECT_WEBSITE <EOL> @ register . simple_tag <EOL> def project_version ( ) : <EOL> return mayan . __version__ <EOL> @ register . assignment_tag ( takes_context = True ) <EOL> def render_subtemplate ( context , template_name , template_context ) : <EOL> """<STR_LIT>""" <EOL> new_context = Context ( context ) <EOL> new_context . update ( Context ( template_context ) ) <EOL> return get_template ( template_name ) . render ( new_context ) <EOL> @ register . assignment_tag <EOL> def build ( ) : <EOL> if BUILD : <EOL> try : <EOL> return '<STR_LIT>' . format ( BUILD ( ) , DATE ( ) . decode ( ) ) <EOL> except sh . ErrorReturnCode_128 : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return '<STR_LIT>' </s>
