Refactor switches in templates: step 2

This commit is contained in:
Vincent Jacques
2012-06-01 18:04:25 +02:00
parent ca390879f0
commit 9f248338ff
4 changed files with 18 additions and 37 deletions
@@ -1,42 +1,7 @@
{% if method.type.name != "bool" %}
self._checkStatus( status, data )
{% endif %}
{% if method.isMutation %}
self._useAttributes( data )
{% endif %}
{% if method.type.simple %}
{% if method.type.cardinality == "scalar" %}
{% if method.type.name == "bool" %}
return status == 204
{% endif %}
{% if method.type.name == "@todo" %}
return data
{% endif %}
{% endif %}
{% if method.type.cardinality == "list" or method.type.cardinality == "dict" %}
return data
{% endif %}
{% else %}
{% if method.type.cardinality == "scalar" %}
return {% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }}( self._requester, data, completed = True )
{% if method.type.name != "void" %}
return {% include "GithubObject.MethodBody.ReturnValue.py" %}
{% endif %}
{% if method.type.cardinality == "list" %}
return PaginatedList.PaginatedList(
{% if method.type.name != class.name %}{{ method.type.name }}.{% endif %}{{ method.type.name }},
self._requester,
headers,
data
)
{% endif %}
{% endif %}