This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lonely(object): | |
instance = None | |
def __new__(cls, *args, **kwargs): | |
if cls.instance is None: | |
cls.instance=object.__new__(cls) | |
return cls.instance | |
def __init__(self, name, lastname): | |
self.name=name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def log(func): | |
@wraps(func) | |
def wrapper(*args,**kwargs): | |
if args: | |
print 'args is: %s, decorated func is: %s, doc: %s ' % (args, func.__name__,func.__doc__) | |
elif kwargs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RevokeCertUsr(forms.Form): | |
name_cert = forms.CharField(max_length=30) | |
send_email_cert = forms.EmailField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="form-inline"> | |
<div class="form-group"> | |
<label class="control-label" for="id_name_vpn">Start Group</label> | |
<input class="form-control" id="id_name_vpn" maxlength="30" | |
name="name_vpn" placeholder="Name vpn" | |
title="Name OpenVPN Service: TestVPN" type="text"/> | |
<span class="help-block">Start Group</span> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import datetime | |
from django.views.generic import TemplateView, FormView | |
from django.http import HttpResponse | |
from analyzer.models import BannedMails | |
from django.db.models import Count | |
from django.core import serializers | |
from forms import SearchFilterForm | |
from django.shortcuts import HttpResponse | |
from myscripts import SearchFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchFilterView(TemplateView, SearchFilter): | |
template_name = 'search_filters.html' | |
success_url = '/analyzer/search_filter/' | |
filters = None | |
print 'fil',filters | |
def get_context_data(self, **kwargs): | |
form = SearchFilterForm | |
context = super(SearchFilterView, self).get_context_data(**kwargs) | |
context['form'] = form | |
if len(self.filters) != 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchFilterView(TemplateView, SearchFilter, ConvertData, Config, SliceData): | |
template_name = 'search_filters.html' | |
success_url = '/analyzer/search_filter/' | |
filters = {} | |
#filters.clear() | |
c = Config() | |
paginate_by = 50 | |
path_xml = c.get_value_confing('general', 'path_xml') | |
def dispatch(self, request, *args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LdapPattern(forms.Form): | |
ldap_start_name = forms.CharField(max_length=50, required=False, label='Start Name Group') | |
ldap_end_name = forms.CharField(max_length=50, required=False, label='End Name Group') | |
class LdapForm(forms.Form): | |
URL = forms.CharField(max_length=30, label='LDAP Server', | |
help_text='Set DNS or IP address server') | |
BindDN = forms.CharField(max_length=200, label='Bind DN', | |
help_text='Set user: user@domain.local') | |
Password = forms.CharField(max_length=200, label='Password', ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LdapView(DecoratorBaseClass, FormView): | |
form_class = LdapForm | |
template_name = 'atmz_ldap_configuration.html' | |
vpn_id = 1 | |
success_url = '/vpn_routing_manage/ldap_view/{}/'.format(vpn_id) | |
def dispatch(self, request, *args, **kwargs): | |
print 'dispatch', request | |
if 'vpn_id' in kwargs: | |
self.vpn_id = kwargs.get('vpn_id') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ldapmixin(object): | |
vpn_id = None | |
def dispatch(self, request, *args, **kwargs) | |
if 'vpn_id' in kwargs: | |
self.vpn_id = kwargs.get('vpn_id') | |
return super(LdapView, self).dispatch(request, args, kwargs) |
OlderNewer