<import> import a library

xml namespace

Import a library. Importing reads the XML associated with a library and makes it available to be installed as an application. This tag must appear within a <server> tag.

Libraries can be installed either from a Python module, or directly from a path. For example, this installs a library from a Python module:

    <import py="moya.libs.auth"/>

And this installs a library from a a relative path:

    <import location="./local/sushishop/" />

The priority attribute is used when two element have the same element reference. This is typically used to override an element in another library. For example, let's say we have the following <macro> in a library called sushifinder.shop, which calculate tax on a shopping cart:

    <macro libname="macro.get_tax">
        <!-- calculate tax for an order-->

We could replace this by defining the following in another library:

    <macro libname="sushifinder.shop#macro.get_tax">
        <!-- custom tax calculator -->

Note the use of a full element reference (including library name) in the libname attribute. This tells Moya that the macro should go in a library other than the one it was declared in. If the code above is in a library with a higher priority then it will replace the macro in the sushifinder.shop library.

The templatepriority is used when there are conflicting template paths. The template from the library with the highest priority wins. This value takes precedence over the priority defined in lib.ini.

name purpose type required? default choices
datapriority Priority for library data integer No
location A path to a Moya library text No
name Name of the library text No
priority Priority for elements integer No
py Python import, e.g. widgets.moya.widgetapp text No
templatepriority Priority for templates integer No
inherited attributes
name purpose type required? default choices
if Conditional expression expression No yes