Conditions | 2 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """ |
||
22 | @blueprint.route('/by_name/<scope_type>/<scope_name>/<snippet_name>') |
||
23 | def get_snippet_by_name(scope_type, scope_name, snippet_name): |
||
24 | """Return the current version of the snippet with that name in that |
||
25 | scope. |
||
26 | """ |
||
27 | scope = Scope(scope_type, scope_name) |
||
28 | version = snippet_service.find_current_version_of_snippet_with_name( |
||
29 | scope, snippet_name |
||
30 | ) |
||
31 | if version is None: |
||
32 | return create_empty_json_response(404) |
||
33 | |||
34 | content = _get_content(version) |
||
35 | |||
36 | return jsonify({ |
||
37 | 'type': version.snippet.type_.name, |
||
38 | 'version': version.id, |
||
39 | 'content': content, |
||
40 | }) |
||
57 |