示例#1
0
    def __init__(self, *args, **kwargs):
        super(FormWsgi, self).__init__(*args, **kwargs)

        self.fields['static'].help_text = _(
            u"<br />Format <strong>/url/ /path/to/media/</strong>, separated by space.<br /><ul><li>/path/to/media/ is path without your home directory</li><li>one directory per one line</li><li>wrong lines will be ignored</li></ul>.")
        self.fields['python_path'].help_text = _(
            u"<br /><strong>~/&lt;your_path&gt;</strong> - One directory per line. Format <strong>/there/is/my/app</strong>. Path is without your home directory")
        self.fields['virtualenv'].help_text = _(
            u"<br />Python virtual environment. You can find yours in '<strong>~/virtualenvs/&lt;selected_virtualenv&gt;</strong>'. Feel free create new one.")
        self.fields['allow_ips'].help_text = _(
            u"<br />One IP per line. If it is blank, no limitation will be applied.")
        self.fields['processes'].help_text = _(
            u"<br />There could be extra fee for additional processes")

        self.fields['processes'].widget.choices = [(one, str(one)) for one in
                                                                   range(1, 5)]

        wsgis = get_user_wsgis(self.user)
        wsgis_choices = [("", _("Not selected"))] + [(x, x) for x in wsgis]
        self.fields['script'].widget.choices = wsgis_choices

        virtualenvs = get_user_venvs(self.user)
        virtualenvs_choices = [("", _("Not selected"))] + [(one, one) for one in
                                                                      virtualenvs]
        self.fields["virtualenv"].widget.choices = virtualenvs_choices
示例#2
0
文件: forms.py 项目: seanchen/pcp
    def __init__(self, *args, **kwargs):
        super(FormWsgi, self).__init__(*args, **kwargs)

        self.fields['static'].help_text = _(
            u"<br />Format <strong>/url/ /path/to/media/</strong>, separated by space.<br /><ul><li>/path/to/media/ is path without your home directory</li><li>one directory per one line</li><li>wrong lines will be ignored</li></ul>.")
        self.fields['python_path'].help_text = _(
            u"<br /><strong>~/&lt;your_path&gt;</strong> - One directory per line. Format <strong>/there/is/my/app</strong>. Path is without your home directory")
        self.fields['virtualenv'].help_text = _(
            u"<br />Python virtual environment. You can find yours in '<strong>~/virtualenvs/&lt;selected_virtualenv&gt;</strong>'. Feel free create new one.")
        self.fields['allow_ips'].help_text = _(
            u"<br />One IP per line. If it is blank, no limitation will be applied.")
        self.fields['processes'].help_text = _(
            u"<br />There could be extra fee for additional processes")

        self.fields['processes'].widget.choices = [(one, str(one)) for one in
                                                                   range(1, 5)]

        wsgis = get_user_wsgis(self.user)
        wsgis_choices = [("", _("Not selected"))] + [(x, x) for x in wsgis]
        self.fields['script'].widget.choices = wsgis_choices

        virtualenvs = get_user_venvs(self.user)
        virtualenvs_choices = [("", _("Not selected"))] + [(one, one) for one in
                                                                      virtualenvs]
        self.fields["virtualenv"].widget.choices = virtualenvs_choices
示例#3
0
def refresh_wsgi(request):
    if not request.is_ajax():
        return HttpResponseForbidden('non ajax not allowed')

    wsgis = get_user_wsgis(request.session.get('switched_user', request.user), False)

    return JsonResponse('OK', wsgis)
示例#4
0
文件: views.py 项目: seanchen/pcp
def refresh_wsgi(request):
    if not request.is_ajax():
        return HttpResponseForbidden('non ajax not allowed')

    wsgis = get_user_wsgis(request.session.get('switched_user', request.user),
                           False)

    return JsonResponse('OK', wsgis)