| 120 | | ### FileDict ################################################################ |
|---|
| 121 | | |
|---|
| 122 | | >>> d = FileDict({'content': 'once upon a time...'}) |
|---|
| | 120 | ### ImmutableList ################################################################ |
|---|
| | 121 | >>> d = ImmutableList(range(10)) |
|---|
| | 122 | >>> d.sort() |
|---|
| | 123 | Traceback (most recent call last): |
|---|
| | 124 | File "<stdin>", line 1, in <module> |
|---|
| | 125 | File "/var/lib/python-support/python2.5/django/utils/datastructures.py", line 359, in complain |
|---|
| | 126 | raise AttributeError, self.warning |
|---|
| | 127 | AttributeError: ImmutableList object is immutable. |
|---|
| 124 | | "{'content': '<omitted>'}" |
|---|
| 125 | | >>> d = FileDict({'other-key': 'once upon a time...'}) |
|---|
| 126 | | >>> repr(d) |
|---|
| 127 | | "{'other-key': 'once upon a time...'}" |
|---|
| | 129 | '(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)' |
|---|
| | 130 | >>> d = ImmutableList(range(10), warning="Object is immutable!") |
|---|
| | 131 | >>> d[1] |
|---|
| | 132 | 1 |
|---|
| | 133 | >>> d[1] = 'test' |
|---|
| | 134 | Traceback (most recent call last): |
|---|
| | 135 | File "<stdin>", line 1, in <module> |
|---|
| | 136 | File "/var/lib/python-support/python2.5/django/utils/datastructures.py", line 359, in complain |
|---|
| | 137 | raise AttributeError, self.warning |
|---|
| | 138 | AttributeError: Object is immutable! |
|---|