<s> from optparse import make_option <EOL> import os <EOL> from fabric import state <EOL> from fabric . decorators import runs_once <EOL> from fabric . context_managers import settings <EOL> from fabric . operations import sudo <EOL> from fabric . contrib . files import exists <EOL> from woven . management . base import WovenCommand <EOL> from woven . webservers import _get_django_sites , deploy_wsgi , deploy_webconf , domain_sites , reload_webservers <EOL> from woven . project import deploy_sitesettings <EOL> class Command ( WovenCommand ) : <EOL> """<STR_LIT>""" <EOL> help = "<STR_LIT>" <EOL> requires_model_validation = False <EOL> def handle_host ( self , * args , ** options ) : <EOL> with settings ( patch = True ) : <EOL> deploy_wsgi ( ) <EOL> deploy_webconf ( ) <EOL> activate_sites = [ '<STR_LIT>' . join ( [ d . name . replace ( '<STR_LIT:.>' , '<STR_LIT:_>' ) , '<STR_LIT:->' , state . env . project_version , '<STR_LIT>' ] ) for d in domain_sites ( ) ] <EOL> site_paths = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> for path in site_paths : <EOL> for site in activate_sites : <EOL> if not exists ( '<STR_LIT:/>' . join ( [ path , '<STR_LIT>' , site ] ) ) : <EOL> sudo ( "<STR_LIT>" % '<STR_LIT:/>' . join ( [ path , '<STR_LIT>' , site ] ) ) <EOL> sudo ( "<STR_LIT>" % ( path , site , path , site ) ) <EOL> if state . env . verbosity : <EOL> print "<STR_LIT>" , "<STR_LIT>" % ( path , site ) <EOL> reload_webservers ( ) </s>
