Removed print debug statements (django will crash if you attempt to write to stdout)
svn: r13953
This commit is contained in:
parent
c800392ffd
commit
2593e8d340
@ -166,15 +166,12 @@ def view_name_detail(request, handle, order, action="view"):
|
|||||||
elif action == "delete":
|
elif action == "delete":
|
||||||
person = Person.objects.get(handle=handle)
|
person = Person.objects.get(handle=handle)
|
||||||
names = person.name_set.all().order_by("order")
|
names = person.name_set.all().order_by("order")
|
||||||
print "delete", names.count()
|
|
||||||
if names.count() > 1:
|
if names.count() > 1:
|
||||||
print "more than 1"
|
|
||||||
name_to_delete = names[0]
|
name_to_delete = names[0]
|
||||||
was_preferred = name_to_delete.preferred
|
was_preferred = name_to_delete.preferred
|
||||||
name_to_delete.delete()
|
name_to_delete.delete()
|
||||||
names = person.name_set.all().order_by("order")
|
names = person.name_set.all().order_by("order")
|
||||||
for count in range(names[1:].count()):
|
for count in range(names[1:].count()):
|
||||||
print count
|
|
||||||
if was_preferred:
|
if was_preferred:
|
||||||
names[count].preferred = True
|
names[count].preferred = True
|
||||||
was_preferred = False
|
was_preferred = False
|
||||||
@ -203,20 +200,16 @@ def view_name_detail(request, handle, order, action="view"):
|
|||||||
form.model = name
|
form.model = name
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
# now it is preferred:
|
# now it is preferred:
|
||||||
print "valid"
|
|
||||||
if name.preferred: # was preferred, stil must be
|
if name.preferred: # was preferred, stil must be
|
||||||
form.cleaned_data["preferred"] = True
|
form.cleaned_data["preferred"] = True
|
||||||
elif form.cleaned_data["preferred"]: # now is
|
elif form.cleaned_data["preferred"]: # now is
|
||||||
# set all of the other names to be
|
# set all of the other names to be
|
||||||
# not preferred:
|
# not preferred:
|
||||||
print "set"
|
|
||||||
person.name_set.filter(~ Q(id=name.id)) \
|
person.name_set.filter(~ Q(id=name.id)) \
|
||||||
.update(preferred=False)
|
.update(preferred=False)
|
||||||
# else some other name is preferred
|
# else some other name is preferred
|
||||||
print "save"
|
|
||||||
set_date(name)
|
set_date(name)
|
||||||
n = form.save()
|
n = form.save()
|
||||||
print n.preferred
|
|
||||||
else:
|
else:
|
||||||
action = "edit"
|
action = "edit"
|
||||||
context = RequestContext(request)
|
context = RequestContext(request)
|
||||||
@ -230,7 +223,6 @@ def view_name_detail(request, handle, order, action="view"):
|
|||||||
context["order"] = name.order
|
context["order"] = name.order
|
||||||
context["next"] = "/person/%s/name/%d" % (person.handle, name.order)
|
context["next"] = "/person/%s/name/%d" % (person.handle, name.order)
|
||||||
view_template = "view_name_detail.html"
|
view_template = "view_name_detail.html"
|
||||||
print "action:", action
|
|
||||||
if action == "save":
|
if action == "save":
|
||||||
context["action"] = "view"
|
context["action"] = "view"
|
||||||
return redirect("/person/%s/name/%d" %
|
return redirect("/person/%s/name/%d" %
|
||||||
@ -305,7 +297,6 @@ def view_detail(request, view, handle, action="view"):
|
|||||||
|
|
||||||
def view_person_detail(request, view, handle, action="view"):
|
def view_person_detail(request, view, handle, action="view"):
|
||||||
context = RequestContext(request)
|
context = RequestContext(request)
|
||||||
print view, handle, action
|
|
||||||
if handle == "add":
|
if handle == "add":
|
||||||
if request.POST.has_key("action"):
|
if request.POST.has_key("action"):
|
||||||
action = request.POST.get("action")
|
action = request.POST.get("action")
|
||||||
@ -350,7 +341,6 @@ def view_person_detail(request, view, handle, action="view"):
|
|||||||
pf.model = person
|
pf.model = person
|
||||||
nf = NameFormFromPerson(request.POST, instance=name)
|
nf = NameFormFromPerson(request.POST, instance=name)
|
||||||
nf.model = name
|
nf.model = name
|
||||||
print "checking:", person.handle
|
|
||||||
if nf.is_valid() and pf.is_valid():
|
if nf.is_valid() and pf.is_valid():
|
||||||
person = pf.save()
|
person = pf.save()
|
||||||
name = nf.save(commit=False)
|
name = nf.save(commit=False)
|
||||||
@ -535,7 +525,6 @@ def view(request, view):
|
|||||||
# BEGIN NON-AUTHENTICATED users
|
# BEGIN NON-AUTHENTICATED users
|
||||||
if request.GET.has_key("search"):
|
if request.GET.has_key("search"):
|
||||||
search = request.GET.get("search")
|
search = request.GET.get("search")
|
||||||
print "search:", search
|
|
||||||
if "," in search:
|
if "," in search:
|
||||||
search_text, trash = [term.strip() for term in search.split(",", 1)]
|
search_text, trash = [term.strip() for term in search.split(",", 1)]
|
||||||
else:
|
else:
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import locale
|
import locale
|
||||||
|
import sys
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -110,10 +111,10 @@ def get_person_from_handle(db, handle):
|
|||||||
try:
|
try:
|
||||||
return db.get_person_from_handle(handle)
|
return db.get_person_from_handle(handle)
|
||||||
except:
|
except:
|
||||||
print "error in get_person_from_handle:"
|
print >> sys.stderr, "error in get_person_from_handle:"
|
||||||
import sys, traceback
|
import sys, traceback
|
||||||
cla, exc, trbk = sys.exc_info()
|
cla, exc, trbk = sys.exc_info()
|
||||||
print _("Error") + (" : %s %s" %(cla, exc))
|
print >> sys.stderr, _("Error") + (" : %s %s" %(cla, exc))
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user