(id, country) [pk] // composite primary key or "created_at" or booking_date [ name: 'name', unique ]
(s, lok, tok)
| 78 | |
| 79 | |
| 80 | def parse_index(s, lok, tok): |
| 81 | ''' |
| 82 | (id, country) [pk] // composite primary key |
| 83 | or |
| 84 | "created_at" |
| 85 | or |
| 86 | booking_date [ |
| 87 | name: 'name', |
| 88 | unique |
| 89 | ] |
| 90 | ''' |
| 91 | init_dict = {} |
| 92 | if isinstance(tok['subject'], (str, ExpressionBlueprint)): |
| 93 | subjects = [tok['subject']] |
| 94 | else: |
| 95 | subjects = list(tok['subject']) |
| 96 | |
| 97 | init_dict['subject_names'] = subjects |
| 98 | settings = tok.get('settings', {}) |
| 99 | init_dict.update(settings) |
| 100 | |
| 101 | # comments after settings have priority |
| 102 | if 'comment' in tok: |
| 103 | init_dict['comment'] = tok['comment'][0] |
| 104 | if 'comment' not in init_dict and 'comment_before' in tok: |
| 105 | comment = '\n'.join(c[0] for c in tok['comment_before']) |
| 106 | init_dict['comment'] = comment |
| 107 | return IndexBlueprint(**init_dict) |
| 108 | |
| 109 | |
| 110 | index.set_parse_action(parse_index) |
nothing calls this directly
no test coverage detected