Example #1
0
def is_website_enabled(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({'result': 'error', 'message': 'no website given'})

    website, _ = Website.get_or_create(hostname=hostname)
    request.reply({'result': 'success', 'enabled': website.enabled})
    def serverconnect(self, server_conn):
        if self._check_should_skip(server_conn=server_conn):
            return SKIP_PIPES

        hostname = server_conn.address.host
        website, _ = Website.get_or_create(hostname=hostname)

        if not website.enabled:
            return self._skip(server_conn=server_conn)
    def response(self, flow):
        if self._check_should_skip(flow=flow):
            return SKIP_PIPES

        hostname = urlparse(flow.request.url).netloc
        website, _ = Website.get_or_create(hostname=hostname)

        if not website.enabled:
            return self._skip(flow=flow)
Example #4
0
def is_website_enabled(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({
            'result': 'error',
            'message': 'no website given'
        })

    website, _ = Website.get_or_create(hostname=hostname)
    request.reply({'result': 'success', 'enabled': website.enabled})
Example #5
0
def enable_website(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({'result': 'error', 'message': 'no website given'})

    website, _ = Website.get_or_create(hostname=hostname)

    if not website.enabled:
        website.enabled = True
        website.save()
    request.reply({'result': 'success'})
Example #6
0
def enable_website(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({
            'result': 'error',
            'message': 'no website given'
        })

    website, _ = Website.get_or_create(hostname=hostname)

    if not website.enabled:
        website.enabled = True
        website.save()
    request.reply({'result': 'success'})