#NEWLINE# def add_asset( self , fname , content , before = None ) : #NEWLINE# #INDENT# ' Add an asset specific for this session.\n        \n        Assets are global to the process (stored in AssetStore\n        ``app.assets``), which is why the ``fname`` is mangled with the\n        session id.\n        \n        Parameters:\n            fname (str): the (relative) filename for the asset.\n            content (str, bytes): the content of the asset. If a str,\n                it is interpreted as the filename or url to the asset.\n                If bytes, it is interpreted as the raw asset content.\n            before (str, None): If given, places the new asset before the\n                given asset.\n        Returns:\n            fname (str): A mangled version of the given ``fname``.\n        ' #NEWLINE# if ( not isinstance ( fname , str ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Asset name must be a string.' ) #NEWLINE# #UNINDENT# ( part1 , dot , part2 ) = fname . rpartition ( '.' ) #NEWLINE# fname = ( '%s-%s%s%s' % ( part1 , self . id , dot , part2 ) ) #NEWLINE# self . add_global_asset ( fname , content , before ) #NEWLINE# return fname