Skip to content

Instantly share code, notes, and snippets.

@meoooh
Last active December 24, 2015 10:59
Show Gist options
  • Save meoooh/6787937 to your computer and use it in GitHub Desktop.
Save meoooh/6787937 to your computer and use it in GitHub Desktop.
$ ./manage.py shell
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/terminal/embed.py:254: DeprecationWarning: With-statements now directly support multiple context managers
with nested(self.builtin_trap, self.display_trap):
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
Type "copyright", "credits" or "license" for more information.
IPython 1.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from vom.forms import *
In [2]: t=Tes
Test TestForm
In [2]: t=TestForm({'sex':4})
In [3]: t.erro
t.error_class t.errors
In [3]: t.errors
Out[3]: {}
In [4]: t.save()
Out[4]: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 t.save()
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
245 self.start_displayhook()
246 self.write_output_prompt()
--> 247 format_dict, md_dict = self.compute_format_data(result)
248 self.write_format_data(format_dict, md_dict)
249 self.update_user_ns(result)
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
155
156 """
--> 157 return self.shell.display_formatter.format(result)
158
159 def write_format_data(self, format_dict, md_dict=None):
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/formatters.pyc in format(self, obj, include, exclude)
150 md = None
151 try:
--> 152 data = formatter(obj)
153 except:
154 # FIXME: log the exception
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
479 type_pprinters=self.type_printers,
480 deferred_pprinters=self.deferred_printers)
--> 481 printer.pretty(obj)
482 printer.flush()
483 return stream.getvalue()
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
360 if callable(meth):
361 return meth(obj, self, cycle)
--> 362 return _default_pprint(obj, self, cycle)
363 finally:
364 self.end_group()
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)
480 if getattr(klass, '__repr__', None) not in _baseclass_reprs:
481 # A user-provided repr.
--> 482 p.text(repr(obj))
483 return
484 p.begin_group(1, '<')
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/django/db/models/base.pyc in __repr__(self)
419 def __repr__(self):
420 try:
--> 421 u = six.text_type(self)
422 except (UnicodeEncodeError, UnicodeDecodeError):
423 u = '[Bad Unicode data]'
TypeError: coercing to Unicode: need string or buffer, bool found
In [5]: t=TestForm({'sex':'hoho'})
In [6]: t.errors
Out[6]: {}
In [7]: t.save()
Out[7]: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 t.save()
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
245 self.start_displayhook()
246 self.write_output_prompt()
--> 247 format_dict, md_dict = self.compute_format_data(result)
248 self.write_format_data(format_dict, md_dict)
249 self.update_user_ns(result)
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
155
156 """
--> 157 return self.shell.display_formatter.format(result)
158
159 def write_format_data(self, format_dict, md_dict=None):
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/formatters.pyc in format(self, obj, include, exclude)
150 md = None
151 try:
--> 152 data = formatter(obj)
153 except:
154 # FIXME: log the exception
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
479 type_pprinters=self.type_printers,
480 deferred_pprinters=self.deferred_printers)
--> 481 printer.pretty(obj)
482 printer.flush()
483 return stream.getvalue()
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
360 if callable(meth):
361 return meth(obj, self, cycle)
--> 362 return _default_pprint(obj, self, cycle)
363 finally:
364 self.end_group()
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)
480 if getattr(klass, '__repr__', None) not in _baseclass_reprs:
481 # A user-provided repr.
--> 482 p.text(repr(obj))
483 return
484 p.begin_group(1, '<')
/home/vom/.virtualenvs/vom/local/lib/python2.7/site-packages/django/db/models/base.pyc in __repr__(self)
419 def __repr__(self):
420 try:
--> 421 u = six.text_type(self)
422 except (UnicodeEncodeError, UnicodeDecodeError):
423 u = '[Bad Unicode data]'
TypeError: coercing to Unicode: need string or buffer, bool found
In [8]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment