Revision 865849d7 snf-astakos-app/astakos/im/management/commands/_common.py
b/snf-astakos-app/astakos/im/management/commands/_common.py | ||
---|---|---|
66 | 66 |
else: |
67 | 67 |
return 'in ' + timeuntil(d) |
68 | 68 |
|
69 |
|
|
69 | 70 |
def format_dict(d, level=1, ident=22): |
70 | 71 |
iteritems = d.iteritems() |
71 | 72 |
if not isinstance(d, OrderedDict): |
... | ... | |
76 | 77 |
l.insert(0, '\n') |
77 | 78 |
return ''.join(l) |
78 | 79 |
|
80 |
|
|
79 | 81 |
def format_set(s): |
80 | 82 |
return list(s) |
81 | 83 |
|
84 |
|
|
82 | 85 |
def format(obj, level=1, ident=22): |
83 | 86 |
if isinstance(obj, bool): |
84 | 87 |
return format_bool(obj) |
... | ... | |
91 | 94 |
else: |
92 | 95 |
return obj |
93 | 96 |
|
97 |
|
|
94 | 98 |
def get_astakosuser_content_type(): |
95 | 99 |
try: |
96 | 100 |
return ContentType.objects.get(app_label='im', |
... | ... | |
148 | 152 |
except Permission.DoesNotExist: |
149 | 153 |
return -1 |
150 | 154 |
|
155 |
|
|
151 | 156 |
def shortened(s, limit, suffix=True): |
152 | 157 |
length = len(s) |
153 | 158 |
if length <= limit: |
Also available in: Unified diff