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 django.core import serializers | |
@login_required | |
def importar(request): | |
assert request.method == 'POST' | |
serialized_text = request.POST['import_json'] | |
for obj in serializers.deserialize('json', serialized_text): | |
if obj.object.__class__ == ModelOne: | |
# haz algo con el modelo |
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
{% extends "admin/change_list.html" %} | |
{% load adminmedia admin_list i18n %} | |
{% load url from future %} | |
{% block content %} | |
{{ block.super }} | |
<div> | |
<form action="/importar/" method="post"> | |
{% csrf_token %} | |
<h1 style="margin-top: 1em;">Importar</h1> |
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
options { | |
listen-on port 53 { 127.0.0.1; }; | |
listen-on-v6 port 53 { ::1; }; | |
directory "/opt/bind-9.8.1-P1/var/named"; | |
dump-file "/opt/bind-9.8.1-P1/var/named/data/cache_dump.db"; | |
statistics-file "/opt/bind-9.8.1-P1/var/named/data/named_stats.txt"; | |
memstatistics-file "/opt/bind-9.8.1-P1/var/named/data/named_mem_stats.txt"; | |
allow-query { localhost; }; | |
recursion yes; |
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
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py | |
index 1e26850..176c461 100644 | |
--- a/source4/scripting/python/samba/netcmd/domain.py | |
+++ b/source4/scripting/python/samba/netcmd/domain.py | |
@@ -848,9 +848,9 @@ class cmd_domain_samba3upgrade(Command): | |
eadb = False | |
elif use_xattrs == "auto" and not s3conf.get("posix:eadb"): | |
if targetdir: | |
- tmpfile = tempfile.NamedTemporaryFile(prefix=os.path.abspath(targetdir)) | |
+ tmpfile = tempfile.NamedTemporaryFile(dir=os.path.abspath(targetdir)) |
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
function check_pipstatus () { | |
PSTATUS=( "${PIPESTATUS[@]}" ) # copiamos array | |
if [ -z "$PSTATUS" ] ; then | |
echo "ERROR: PIPESTATUS no fue pasado por parametro" | |
exit 1 | |
fi | |
if [ ${#PSTATUS[@]} -lt 2 ] ; then | |
echo "ERROR: PIPESTATUS posee menos de 2 elementos" | |
exit 1 |
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
# Permit time synchronization with our time source, but do not | |
# permit the source to query or modify the service on this system. | |
restrict default kod nomodify notrap nopeer noquery | |
restrict -6 default kod nomodify notrap nopeer noquery | |
# Permit all access over the loopback interface. This could | |
# be tightened as well, but to do so would effect some of | |
# the administrative functions. | |
restrict 127.0.0.1 | |
restrict -6 ::1 |
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
index 58478ec..31e2833 100644 | |
--- a/src/django_openid_auth/auth.py | |
+++ b/src/django_openid_auth/auth.py | |
@@ -30,6 +30,9 @@ | |
__metaclass__ = type | |
+import logging | |
+import pprint | |
+ |
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
def log_performance(f): | |
@wraps(f) | |
def wrapper(*args, **kwds): | |
start = datetime.datetime.now() | |
ret = f(*args, **kwds) | |
end = datetime.datetime.now() | |
took = end - start | |
took = took.seconds + took.microseconds / 1000000.0 | |
logging.info("Call to %s() took: %f secs.", f.func_name, took) | |
return ret |
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
# -*- coding: utf-8 -*- | |
from django import template | |
from django.contrib import messages | |
register = template.Library() | |
LEVEL_TO_CSS = { | |
messages.ERROR: "error", | |
messages.WARNING: "notice", |
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
# | |
# To be used with 'http://djangosnippets.org/snippets/1570/' | |
# | |
@contextmanager | |
def server_thread(address, port): | |
server = TestServerThread(address, port) | |
try: | |
server.start() | |
yield server |