Commit b8ffa4c9 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent eea23a21
...@@ -625,7 +625,7 @@ ...@@ -625,7 +625,7 @@
bitmap: "110011", bitmap: "110011",
cdm_type: "fd_cdm2", cdm_type: "fd_cdm2",
{%- else %} {%- else %}
{%- do error(icell, "unsupported number of DL antennas") %} {%- do ierror(icell, "unsupported number of DL antennas") %}
{%- endif %} {%- endif %}
}, },
{%- if tdd_config != 3 %} {%- if tdd_config != 3 %}
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{%- set ru = iru['_'] %} {%- set ru = iru['_'] %}
{%- if len(icell_list) != 1 %} {%- if len(icell_list) != 1 %}
{%- do error(iru, 'ru/lopcomm supports only 1 cell ; requested %d' % len(icell_list)) %} {%- do ierror(iru, 'ru/lopcomm supports only 1 cell ; requested %d' % len(icell_list)) %}
{%- endif %} {%- endif %}
{%- set icell = icell_list[0] %} {%- set icell = icell_list[0] %}
{%- set cell = icell['_'] %} {%- set cell = icell['_'] %}
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
# #
# Recommended usage of encode in buildout profiles is via B as illustrated below: # Recommended usage of encode in buildout profiles is via B as illustrated below:
# #
# {#- B(name) returns buildout-encoded form of name #} # {#- B(name) escapes name to be safe to use in buildout code. #}
# {%- set B = xbuildout.encode %} # {%- set B = xbuildout.encode %}
# #
# ... # ...
......
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
In the code iX denotes shared instance of type X, while X denotes In the code iX denotes shared instance of type X, while X denotes
parameters passed to iX. For example iru denotes Radio Unit shared parameters passed to iX. For example iru denotes Radio Unit shared
instance, while ru denotes parameters of that Radio Unit instance. instance, while ru denotes parameters of that Radio Unit instance.
The following utilities are also provided:
- B escapes string to be safe to use in buildout code.
- J should be used around macro calls to retrieve returned objects.
- ierror reports an error about shared instance.
-#} -#}
...@@ -78,7 +84,18 @@ ...@@ -78,7 +84,18 @@
%} %}
{#- XXX explain #} {#- B(name) escapes name to be safe to use in buildout code.
It escapes buildout control characters in the string so that the result
could be used in buildout code without the risk of buildout profile to
become broken and/or with injected code when handling string input from
outside.
The most often case when B needs to be used is when handling references of
shared instances in generated buildout code.
See xbuildout.encode documentation for details.
#}
{%- set B = xbuildout.encode %} {%- set B = xbuildout.encode %}
{#- J is used around macro calls to retrieve returned objects. {#- J is used around macro calls to retrieve returned objects.
...@@ -129,10 +146,9 @@ ...@@ -129,10 +146,9 @@
{%- do assert(False, msg) %} {%- do assert(False, msg) %}
{%- endmacro %} {%- endmacro %}
{#- error reports an error about shared instance #} {#- ierror reports an error about shared instance. #}
{#- XXX -> ierror ? #} {#- XXX ierror(ishared, msg) vvv is debug stub -#}
{#- XXX error(ishared, msg) vvv is debug stub -#} {%- macro ierror(ishared, msg) %}
{%- macro error(ishared, msg) %}
{%- set msg = 'E: %s: %s\n' % (J(jref_of_shared(ishared)), msg) %} {%- set msg = 'E: %s: %s\n' % (J(jref_of_shared(ishared)), msg) %}
{%- do assert(False, msg) %} {%- do assert(False, msg) %}
{%- endmacro %} {%- endmacro %}
...@@ -150,7 +166,7 @@ ...@@ -150,7 +166,7 @@
{#- check_loaded_everything verifies that all shared instances were handling during the load. #} {#- check_loaded_everything verifies that all shared instances were handling during the load. #}
{%- macro check_loaded_everything() %} {%- macro check_loaded_everything() %}
{%- for ishared in qshared_instance_list %} {%- for ishared in qshared_instance_list %}
{%- do error(ishared, "shared instance of unsupported type") %} {%- do ierror(ishared, "shared instance of unsupported type") %}
{%- endfor %} {%- endfor %}
{%- endmacro %} {%- endmacro %}
...@@ -236,7 +252,7 @@ ...@@ -236,7 +252,7 @@
{%- for _, icell in icell_dict|dictsort %} {%- for _, icell in icell_dict|dictsort %}
{%- set ru_ref = J(jcell_ru_ref(icell, icell_dict)) %} {%- set ru_ref = J(jcell_ru_ref(icell, icell_dict)) %}
{%- if ru_ref not in iru_dict %} {%- if ru_ref not in iru_dict %}
{%- do error(icell, "referred RU %s does not exist" % ru_ref) %} {%- do ierror(icell, "referred RU %s does not exist" % ru_ref) %}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
...@@ -273,7 +289,7 @@ ...@@ -273,7 +289,7 @@
{%- set cell_ref = J(jref_of_shared(icell)) %} {%- set cell_ref = J(jref_of_shared(icell)) %}
{%- if cell_ref in seen %} {%- if cell_ref in seen %}
{%- for x in seen %} {%- for x in seen %}
{%- do error(x, "%s form a cycle via RU references" % seen) %} {%- do ierror(x, "%s form a cycle via RU references" % seen) %}
{%- endfor %} {%- endfor %}
{#- XXX what to return ? #} {#- XXX what to return ? #}
{%- else %} {%- else %}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment