<s> '''<STR_LIT>''' <EOL> import socket <EOL> import logging <EOL> from django . core . management . base import NoArgsCommand <EOL> from django_dust import retry_storage <EOL> from django_dust . storage import DistributedStorage <EOL> from django_dust . http import HTTPError <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> def _to_unicode ( retry ) : <EOL> return u'<STR_LIT>' % retry <EOL> class Command ( NoArgsCommand ) : <EOL> help = "<STR_LIT>" <EOL> def handle_noargs ( self , ** options ) : <EOL> logger . info ( '<STR_LIT>' ) <EOL> storage = DistributedStorage ( ) <EOL> retries = retry_storage . all ( ) <EOL> logger . info ( '<STR_LIT>' % len ( retries ) ) <EOL> for retry in retries : <EOL> logger . info ( '<STR_LIT>' % _to_unicode ( retry ) ) <EOL> try : <EOL> if retry [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> body = storage . transport . get ( retry [ '<STR_LIT>' ] , retry [ '<STR_LIT:filename>' ] ) <EOL> storage . transport . put ( retry [ '<STR_LIT>' ] , retry [ '<STR_LIT:filename>' ] , body ) <EOL> if retry [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> storage . transport . delete ( retry [ '<STR_LIT>' ] , retry [ '<STR_LIT:filename>' ] ) <EOL> retry_storage . delete ( retry ) <EOL> except ( socket . error , HTTPError ) , e : <EOL> logger . warning ( '<STR_LIT>' % ( _to_unicode ( retry ) , e ) ) <EOL> pass <EOL> logger . info ( '<STR_LIT>' % retry_storage . count ( ) ) </s>
