Пример #1
0
 def get_context(self, user):
     context = {
         'username': user.username,
         'password': user.password,
         'host': settings.DATABASES_DEFAULT_HOST,
     }
     return replace(replace(context, "'", '"'), ';', '')
Пример #2
0
 def get_context(self, user):
     context = {
         'username': user.username,
         'password': user.password,
         'host': settings.DATABASES_DEFAULT_HOST,
     }
     return replace(replace(context, "'", '"'), ';', '')
Пример #3
0
 def get_context(self, db):
     context = {
         'db_name': db.name,
         'db_dirname': db.name.replace('-', '@003f'),
         'db_id': db.pk,
         'db_type': db.type,
     }
     return replace(replace(context, "'", '"'), ';', '')
Пример #4
0
 def get_context(self, webapp):
     context = super(PHPBackend, self).get_context(webapp)
     context.update({
         'php_version': webapp.type_instance.get_php_version(),
         'php_version_number': webapp.type_instance.get_php_version_number(),
         'max_requests': settings.WEBAPPS_PHP_MAX_REQUESTS,
     })
     self.update_fpm_context(webapp, context)
     # Fcgid context do contain special charactes
     replace(context, "'", '"')
     self.update_fcgid_context(webapp, context)
     return context
Пример #5
0
 def get_context(self, webapp):
     context = super(PHPController, self).get_context(webapp)
     options = webapp.get_options()
     context.update({
         'python_version': webapp.type_instance.get_python_version(),
         'python_version_number': webapp.type_instance.get_python_version_number(),
         'max_requests': settings.WEBAPPS_PYTHON_MAX_REQUESTS,
         'workers': options.get('processes', settings.WEBAPPS_PYTHON_DEFAULT_MAX_WORKERS),
         'timeout': options.get('timeout', settings.WEBAPPS_PYTHON_DEFAULT_TIMEOUT),
     })
     self.update_uwsgi_context(webapp, context)
     replace(context, "'", '"')
     return context
Пример #6
0
 def get_context(self, webapp):
     context = super(PHPBackend, self).get_context(webapp)
     options = webapp.get_options()
     context.update({
         'python_version': webapp.type_instance.get_python_version(),
         'python_version_number': webapp.type_instance.get_python_version_number(),
         'max_requests': settings.WEBAPPS_PYTHON_MAX_REQUESTS,
         'workers': options.get('processes', settings.WEBAPPS_PYTHON_DEFAULT_MAX_WORKERS),
         'timeout': options.get('timeout', settings.WEBAPPS_PYTHON_DEFAULT_TIMEOUT),
     })
     self.update_uwsgi_context(webapp, context)
     replace(context, "'", '"')
     return context
Пример #7
0
 def update_fcgid_context(self, webapp, context):
     wrapper_path = webapp.type_instance.FCGID_WRAPPER_PATH % context
     context.update({
         'wrapper': self.get_fcgid_wrapper(webapp, context),
         'wrapper_path': wrapper_path,
         'wrapper_dir': os.path.dirname(wrapper_path),
     })
     replace(context, "'", '"')
     context.update({
         'cmd_options': self.get_fcgid_cmd_options(webapp, context),
         'cmd_options_path': settings.WEBAPPS_FCGID_CMD_OPTIONS_PATH % context,
     })
     return context
Пример #8
0
 def get_context(self, webapp):
     context = super(MoodleController, self).get_context(webapp)
     contents = webapp.content_set.all()
     context.update({
         'db_type':
         'mysqli',
         'db_name':
         webapp.data['db_name'],
         'db_user':
         webapp.data['db_user'],
         'password':
         webapp.data['password'],
         'db_host':
         settings.WEBAPPS_DEFAULT_MYSQL_DATABASE_HOST,
         'email':
         webapp.account.email,
         'site_name':
         "%s Courses" % webapp.account.get_full_name(),
         'cms_cache_dir':
         os.path.normpath(settings.WEBAPPS_CMS_CACHE_DIR),
         'www_root':
         contents[0].website.get_absolute_url()
         if contents else 'http://empty'
     })
     return replace(context, '"', "'")
Пример #9
0
 def get_context(self, webapp):
     context = super(DokuWikiMuBackend, self).get_context(webapp)
     context.update({
         'template': settings.SAAS_DOKUWIKI_TEMPLATE_PATH,
         'app_path': os.path.join(settings.SAAS_DOKUWIKI_FARM_PATH, webapp.name)
     })
     return replace(context, "'", '"')
Пример #10
0
 def get_context(self, site):
     context = {
         'log_file': '%s{,.1}' % site.get_www_access_log_path(),
         'last_date': self.get_last_date(site.pk).strftime("%Y-%m-%d %H:%M:%S %Z"),
         'object_id': site.pk,
     }
     return replace(context, "'", '"')
Пример #11
0
 def get_context(self, mail_list):
     context = {
         'list_name': mail_list.name,
         'object_id': mail_list.pk,
         'last_date': self.get_last_date(mail_list.pk).strftime("%Y-%m-%d %H:%M:%S %Z"),
     }
     return replace(context, "'", '"')
Пример #12
0
 def get_context(self, user):
     context = {
         'last_date': self.get_last_date(user.pk).strftime("%Y-%m-%d %H:%M:%S %Z"),
         'object_id': user.pk,
         'username': user.username,
     }
     return replace(context, "'", '"')
Пример #13
0
 def get_context(self, mailbox):
     context = {
         'home': mailbox.get_home(),
         'object_id': mailbox.pk
     }
     context['maildir_path'] = settings.MAILBOXES_MAILDIRSIZE_PATH % context
     return replace(context, "'", '"')
Пример #14
0
 def get_context(self, user):
     context = {
         "last_date": self.get_last_date(user.pk).strftime("%Y-%m-%d %H:%M:%S %Z"),
         "object_id": user.pk,
         "username": user.username,
     }
     return replace(context, "'", '"')
Пример #15
0
 def get_context(self, mailbox):
     context = {
         'mailbox': mailbox.name,
         'object_id': mailbox.pk,
         'last_date': self.get_last_date(mailbox.pk).strftime("%Y-%m-%d %H:%M:%S %Z"),
     }
     return replace(context, "'", '"')
Пример #16
0
 def get_context(self, mail_list):
     context = {
         "list_name": mail_list.name,
         "object_id": mail_list.pk,
         "last_date": self.get_last_date(mail_list.pk).strftime("%Y-%m-%d %H:%M:%S %Z"),
     }
     return replace(context, "'", '"')
Пример #17
0
 def get_context(self, user):
     context = {
         'last_date': self.get_last_date(user.pk).strftime("%Y-%m-%d %H:%M:%S %Z"),
         'object_id': user.pk,
         'username': user.username,
     }
     return replace(context, "'", '"')
Пример #18
0
 def get_context(self, saas):
     context = {
         'bsadmin': settings.SAAS_BSCW_BSADMIN_PATH,
         'email': saas.data.get('email'),
         'username': saas.name,
         'password': getattr(saas, 'password', None),
     }
     return replace(context, "'", '"')
Пример #19
0
 def get_context(self, address):
     context = self.get_context_files()
     context.update({
         'domain': address.domain,
         'email': address.email,
         'local_domain': settings.MAILBOXES_LOCAL_DOMAIN,
     })
     return replace(context, "'", '"')
Пример #20
0
 def get_context(self, saas):
     context = {
         'bsadmin': settings.SAAS_BSCW_BSADMIN_PATH,
         'email': saas.data.get('email'),
         'username': saas.name,
         'password': getattr(saas, 'password', None),
     }
     return replace(context, "'", '"')
Пример #21
0
 def set_content_context(self, content, context):
     content_context = {
         'type': content.webapp.type,
         'location': normurlpath(content.path),
         'app_name': content.webapp.name,
         'app_path': content.webapp.get_path(),
     }
     content_context = replace(content_context, "'", '"')
     context.update(content_context)
Пример #22
0
 def get_context(self, content):
     conf_file = "%s.conf" % content.website.unique_name
     context = {
         'site_logs': content.website.get_www_access_log_path(),
         'site_name': content.website.name,
         'webapp_path': content.webapp.get_path(),
         'webalizer_path': os.path.join(content.webapp.get_path(), content.website.name),
         'webalizer_conf_path': os.path.join(settings.WEBSITES_WEBALIZER_PATH, conf_file),
         'user': content.webapp.account.username,
         'banner': self.get_banner(),
     }
     context['webalizer_conf'] = textwrap.dedent("""\
         # %(banner)s
         LogFile            %(site_logs)s
         LogType            clf
         OutputDir          %(webalizer_path)s
         HistoryName        webalizer.hist
         Incremental        yes
         IncrementalName    webalizer.current
         ReportTitle        Stats of
         HostName           %(site_name)s
         
         PageType       htm*
         PageType       php*
         PageType       shtml
         PageType       cgi
         PageType       pl
         
         DNSCache       /var/lib/dns_cache.db
         DNSChildren    15
         
         HideURL        *.gif
         HideURL        *.GIF
         HideURL        *.jpg
         HideURL        *.JPG
         HideURL        *.png
         HideURL        *.PNG
         HideURL        *.ra
         
         IncludeURL     *
         
         SearchEngine   yahoo.com       p=
         SearchEngine   altavista.com   q=
         SearchEngine   google.com      q=
         SearchEngine   eureka.com      q=
         SearchEngine   lycos.com       query=
         SearchEngine   hotbot.com      MT=
         SearchEngine   msn.com         MT=
         SearchEngine   infoseek.com    qt=
         SearchEngine   webcrawler      searchText=
         SearchEngine   excite          search=
         SearchEngine   netscape.com    search=
         SearchEngine   mamma.com       query=
         SearchEngine   alltheweb.com   query=
         
         DumpSites      yes""") % context
     return replace(context, "'", '"')
Пример #23
0
 def get_context(self, mailbox):
     context = {
         'user': mailbox.name,
         'group': mailbox.name,
         'password': mailbox.password if mailbox.active else '*%s' % mailbox.password,
         'home': mailbox.get_home(),
         'initial_shell': '/dev/null',
     }
     return replace(context, "'", '"')
Пример #24
0
 def get_context(self, webapp):
     context = super(WordPressBackend, self).get_context(webapp)
     context.update({
         'db_name': webapp.data['db_name'],
         'db_user': webapp.data['db_user'],
         'password': webapp.data['password'],
         'db_host': settings.WEBAPPS_DEFAULT_MYSQL_DATABASE_HOST,
         'email': webapp.account.email,
         'title': "%s blog's" % webapp.account.get_full_name(),
     })
     return replace(context, '"', "'")
Пример #25
0
 def get_context(self, mailbox):
     context = {
         'user': mailbox.name,
         'group': mailbox.name,
         'name': mailbox.name,
         'password': mailbox.password if mailbox.active else '*%s' % mailbox.password,
         'home': mailbox.get_home(),
         'maildir': os.path.join(mailbox.get_home(), 'Maildir'),
         'initial_shell': self.SHELL,
         'banner': self.get_banner(),
     }
     return replace(context, "'", '"')
Пример #26
0
 def get_context(self, user):
     context = {
         'object_id': user.pk,
         'user': user.username,
         'group': user.username,
         'password': user.password if user.active else '*%s' % user.password,
         'shell': user.shell,
         'mainuser': user.username if user.is_main else user.account.username,
         'home': user.get_home(),
         'base_home': user.get_base_home(),
     }
     context['deleted_home'] = settings.SYSTEMUSERS_MOVE_ON_DELETE_PATH % context
     return replace(context, "'", '"')
Пример #27
0
 def get_context(self, mail_list):
     context = self.get_context_files()
     context.update({
         'banner': self.get_banner(mail_list),
         'name': mail_list.name,
         'password': mail_list.password,
         'domain': mail_list.address_domain or settings.LISTS_DEFAULT_DOMAIN,
         'address_name': mail_list.get_address_name(),
         'address_domain': mail_list.address_domain,
         'suffixes_regex': '\|'.join(self.address_suffixes),
         'admin': mail_list.admin_email,
         'mailman_root': settings.LISTS_MAILMAN_ROOT_DIR,
     })
     return replace(context, "'", '"')
Пример #28
0
 def get_context(self, webapp):
     context = super(WordPressController, self).get_context(webapp)
     context.update(
         {
             "db_name": webapp.data["db_name"],
             "db_user": webapp.data["db_user"],
             "password": webapp.data["password"],
             "db_host": settings.WEBAPPS_DEFAULT_MYSQL_DATABASE_HOST,
             "email": webapp.account.email,
             "title": "%s blog's" % webapp.account.get_full_name(),
             "cms_cache_dir": os.path.normpath(settings.WEBAPPS_CMS_CACHE_DIR),
         }
     )
     return replace(context, '"', "'")
Пример #29
0
 def get_context(self, mail_list):
     context = self.get_context_files()
     context.update({
         'banner': self.get_banner(mail_list),
         'name': mail_list.name,
         'password': mail_list.password,
         'domain': mail_list.address_domain or settings.LISTS_DEFAULT_DOMAIN,
         'address_name': mail_list.get_address_name(),
         'address_domain': mail_list.address_domain,
         'suffixes_regex': '\|'.join(self.address_suffixes),
         'admin': mail_list.admin_email,
         'mailman_root': settings.LISTS_MAILMAN_ROOT_DIR,
     })
     return replace(context, "'", '"')
Пример #30
0
 def get_context(self, user):
     context = {
         "object_id": user.pk,
         "user": user.username,
         "group": user.username,
         "password": user.password if user.active else "*%s" % user.password,
         "shell": user.shell,
         "mainuser": user.username if user.is_main else user.account.username,
         "home": user.get_home(),
         "base_home": user.get_base_home(),
         "mainuser_home": user.main.get_home(),
     }
     context["deleted_home"] = settings.SYSTEMUSERS_MOVE_ON_DELETE_PATH % context
     return replace(context, "'", '"')
Пример #31
0
 def get_context(self, user):
     context = {
         'object_id': user.pk,
         'user': user.username,
         'group': user.username,
         'groups': ','.join(self.get_groups(user)),
         'password': user.password if user.active else '*%s' % user.password,
         'shell': user.shell,
         'mainuser': user.username if user.is_main else user.account.username,
         'home': user.get_home(),
         'base_home': user.get_base_home(),
         'mainuser_home': user.main.get_home(),
     }
     context['deleted_home'] = settings.SYSTEMUSERS_MOVE_ON_DELETE_PATH % context
     return replace(context, "'", '"')
Пример #32
0
 def get_context(self, webapp):
     context = super(MoodleController, self).get_context(webapp)
     contents = webapp.content_set.all()
     context.update({
         'db_type': 'mysqli',
         'db_name': webapp.data['db_name'],
         'db_user': webapp.data['db_user'],
         'password': webapp.data['password'],
         'db_host': settings.WEBAPPS_DEFAULT_MYSQL_DATABASE_HOST,
         'email': webapp.account.email,
         'site_name': "%s Courses" % webapp.account.get_full_name(),
         'cms_cache_dir': os.path.normpath(settings.WEBAPPS_CMS_CACHE_DIR),
         'www_root': contents[0].website.get_absolute_url() if contents else 'http://empty'
     })
     return replace(context, '"', "'")
Пример #33
0
 def get_context(self, mail_list):
     context = self.get_context_files()
     context.update(
         {
             "banner": self.get_banner(mail_list),
             "name": mail_list.name,
             "password": mail_list.password,
             "domain": mail_list.address_domain or settings.LISTS_DEFAULT_DOMAIN,
             "address_name": mail_list.get_address_name(),
             "address_domain": mail_list.address_domain,
             "suffixes_regex": "\|".join(self.address_suffixes),
             "admin": mail_list.admin_email,
             "mailman_root": settings.LISTS_MAILMAN_ROOT_DIR,
         }
     )
     return replace(context, "'", '"')
Пример #34
0
 def get_context(self, domain):
     context = {
         'name': domain.name,
         'banner': self.get_banner(),
         'subdomains': domain.subdomains.all(),
         'masters': '; '.join(self.get_masters(domain)) or 'none',
         'conf_path': self.CONF_PATH,
     }
     context['conf'] = textwrap.dedent("""
         zone "%(name)s" {
             // %(banner)s
             type slave;
             file "%(name)s";
             masters { %(masters)s; };
             allow-notify { %(masters)s; };
         };""") % context
     return replace(context, "'", '"')
Пример #35
0
 def get_context(self, webapp):
     context = super(WordPressController, self).get_context(webapp)
     context.update({
         'db_name':
         webapp.data['db_name'],
         'db_user':
         webapp.data['db_user'],
         'password':
         webapp.data['password'],
         'db_host':
         settings.WEBAPPS_DEFAULT_MYSQL_DATABASE_HOST,
         'email':
         webapp.account.email,
         'title':
         "%s blog's" % webapp.account.get_full_name(),
         'cms_cache_dir':
         os.path.normpath(settings.WEBAPPS_CMS_CACHE_DIR)
     })
     return replace(context, '"', "'")
Пример #36
0
 def get_context(self, domain):
     slaves = self.get_slaves(domain)
     context = {
         'name': domain.name,
         'zone_path': settings.DOMAINS_ZONE_PATH % {'name': domain.name},
         'subdomains': domain.subdomains.all(),
         'banner': self.get_banner(),
         'slaves': '; '.join(slaves) or 'none',
         'also_notify': '; '.join(slaves) + ';' if slaves else '',
         'conf_path': self.CONF_PATH,
     }
     context['conf'] = textwrap.dedent("""
         zone "%(name)s" {
             // %(banner)s
             type master;
             file "%(zone_path)s";
             allow-transfer { %(slaves)s; };
             also-notify { %(also_notify)s };
             notify yes;
         };""") % context
     return replace(context, "'", '"')
Пример #37
0
 def get_context(self, mailbox):
     context = {
         'name': mailbox.name,
         'user': mailbox.name,
         'password': mailbox.password if mailbox.active else '*%s' % mailbox.password,
         'uid': 10000 + mailbox.pk,
         'gid': 10000 + mailbox.pk,
         'group': self.DEFAULT_GROUP,
         'quota': self.get_quota(mailbox),
         'passwd_path': settings.MAILBOXES_PASSWD_PATH,
         'home': mailbox.get_home(),
         'banner': self.get_banner(),
         'virtual_mailbox_maps': settings.MAILBOXES_VIRTUAL_MAILBOX_MAPS_PATH,
         'mailbox_domain': settings.MAILBOXES_VIRTUAL_MAILBOX_DEFAULT_DOMAIN,
     }
     context['extra_fields'] = self.get_extra_fields(mailbox, context)
     context.update({
         'passwd': '{user}:{password}:{uid}:{gid}::{home}::{extra_fields}'.format(**context),
         'deleted_home': settings.MAILBOXES_MOVE_ON_DELETE_PATH % context,
     })
     return replace(context, "'", '"')
Пример #38
0
 def get_context(self, site):
     base_apache_conf = settings.WEBSITES_BASE_APACHE_CONF
     sites_available = os.path.join(base_apache_conf, 'sites-available')
     sites_enabled = os.path.join(base_apache_conf, 'sites-enabled')
     server_name, server_alias = self.get_server_names(site)
     context = {
         'site': site,
         'site_name': site.name,
         'ips': settings.WEBSITES_DEFAULT_IPS,
         'site_unique_name': site.unique_name,
         'user': self.get_username(site),
         'group': self.get_groupname(site),
         'server_name': server_name,
         'server_alias': server_alias,
         'sites_enabled': "%s.conf" % os.path.join(sites_enabled, site.unique_name),
         'sites_available': "%s.conf" % os.path.join(sites_available, site.unique_name),
         'access_log': site.get_www_access_log_path(),
         'error_log': site.get_www_error_log_path(),
         'banner': self.get_banner(),
     }
     if not context['ips']:
         raise ValueError("WEBSITES_DEFAULT_IPS is empty.")
     return replace(context, "'", '"')
Пример #39
0
 def get_context(self, user):
     context = {
         'object_id': user.pk,
         'base_home': user.get_base_home(),
     }
     return replace(context, "'", '"')
Пример #40
0
 def get_context(self, webapp):
     context = super(SymbolicLinkController, self).get_context(webapp)
     context.update({
         'link_path': webapp.data['path'],
     })
     return replace(context, "'", '"')
Пример #41
0
 def get_context(self, database):
     context = {
         'database': database.name,
         'host': settings.DATABASES_DEFAULT_HOST,
     }
     return replace(replace(context, "'", '"'), ';', '')
Пример #42
0
 def get_context(self, mail_list):
     context = self.get_context_files()
     context.update({
         'address_domain': mail_list.address_domain,
     })
     return replace(context, "'", '"')
Пример #43
0
 def get_context(self, user):
     context = {
         'object_id': user.pk,
         'base_home': user.get_base_home(),
     }
     return replace(context, "'", '"')
Пример #44
0
 def get_context(self, mail_list):
     context = {
         'list_name': mail_list.name,
         'object_id': mail_list.pk,
     }
     return replace(context, "'", '"')