| 671 | #### FIELD ######################################################################################### |
| 672 | |
| 673 | class _String(str): |
| 674 | # The STRING constant can be called with a length when passed to field(), |
| 675 | # for example field("language", type=STRING(2), default="en", index=True). |
| 676 | def __new__(self): |
| 677 | return str.__new__(self, "string") |
| 678 | def __call__(self, length=100): |
| 679 | return "varchar(%s)" % (length>255 and 255 or (length<1 and 1 or length)) |
| 680 | |
| 681 | # Field type. |
| 682 | # Note: SQLite string fields do not impose a string limit. |
no outgoing calls
no test coverage detected
searching dependent graphs…