একটি অতিরিক্ত পরামর্শ।
আপনি লিভারেজ করতে nosetests এবং পিডিবি একসঙ্গে, বরং ইনজেকশনের pdb.set_trace()
নিজে আপনার দেখার। সুবিধাটি হ'ল আপনি ত্রুটি শর্তগুলি প্রথমবার শুরু করার পরে তৃতীয় পক্ষের কোডে পর্যবেক্ষণ করতে পারবেন।
আজ আমার জন্য একটি ত্রুটি এখানে।
TypeError at /db/hcm91dmo/catalog/records/
render_option() argument after * must be a sequence, not int
....
Error during template rendering
In template /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/crispy_forms/templates/bootstrap3/field.html, error at line 28
render_option() argument after * must be a sequence, not int
18
19 {% if field|is_checkboxselectmultiple %}
20 {% include 'bootstrap3/layout/checkboxselectmultiple.html' %}
21 {% endif %}
22
23 {% if field|is_radioselect %}
24 {% include 'bootstrap3/layout/radioselect.html' %}
25 {% endif %}
26
27 {% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
28
{% if field|is_checkbox and form_show_labels %}
এখন, আমি জানি যে এর অর্থ আমি ফর্মটির জন্য নির্মাতাকে গোফড করেছি এবং কোন ক্ষেত্রটি সমস্যা তা আমার ভাল ধারণাও রয়েছে। তবে, আমি কোনও টেমপ্লেটের মধ্যে খ্রিষ্টসম্পন্ন ফর্মগুলির সম্পর্কে কী অভিযোগ করছে তা দেখতে পিডিবি ব্যবহার করতে পারি ?
হ্যা আমি পারি. নাকেস্টেটে --pdb বিকল্পটি ব্যবহার করে :
tests$ nosetests test_urls_catalog.py --pdb
যত তাড়াতাড়ি আমি যেকোন ব্যতিক্রমকে হিট করার সাথে সাথে (পিরিয়ডলি হ্যান্ডেলগুলি সহ) পিডিবি যেখানে ঘটে তা থামায় এবং আমি চারপাশে দেখতে পারি।
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/forms/forms.py", line 537, in __str__
return self.as_widget()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/forms/forms.py", line 593, in as_widget
return force_text(widget.render(name, self.value(), attrs=attrs))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/forms/widgets.py", line 513, in render
options = self.render_options(choices, [value])
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/forms/widgets.py", line 543, in render_options
output.append(self.render_option(selected_choices, *option))
TypeError: render_option() argument after * must be a sequence, not int
INFO lib.capture_middleware log write_to_index(http://localhost:8082/db/hcm91dmo/catalog/records.html)
INFO lib.capture_middleware log write_to_index:end
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/forms/widgets.py(543)render_options()
-> output.append(self.render_option(selected_choices, *option))
(Pdb) import pprint
(Pdb) pprint.PrettyPrinter(indent=4).pprint(self)
<django.forms.widgets.Select object at 0x115fe7d10>
(Pdb) pprint.PrettyPrinter(indent=4).pprint(vars(self))
{ 'attrs': { 'class': 'select form-control'},
'choices': [[('_', 'any type'), (7, (7, 'type 7', 'RECTYPE_TABLE'))]],
'is_required': False}
(Pdb)
এখন, এটি স্পষ্ট যে খাঁটি ক্ষেত্র নির্মাতার কাছে আমার পছন্দগুলি যুক্তি যেমন টিপলসের তালিকা / তালিকার চেয়ে তালিকার মধ্যে একটি তালিকা ছিল।
'choices': [[('_', 'any type'), (7, (7, 'type 7', 'RECTYPE_TABLE'))]]
ঝরঝরে বিষয় হ'ল এই পিডিবিটি ক্রাইপাই কোডের মধ্যেই ঘটছে, আমার নয় এবং আমি নিজে এটি প্রবেশ করানোর দরকার পড়েনি didn't