Example #1
0
def navdiff(oldnp, newnp, backlinks=False):
    if oldnp.to_end.type != newnp.to_end.type:
        logging.info("%s.%s Navigation target type changed from %s to %s",
                     oldnp.parent.name, oldnp.name,
                     oldnp.to_end.type, newnp.to_end.type)
    if oldnp.to_end.multiplicity != newnp.to_end.multiplicity:
        logging.info("%s.%s Navigation target multiplicity changed "
                     "from %s to %s",
                     oldnp.parent.name, oldnp.name,
                     edm.multiplicity_to_str(oldnp.to_end.multiplicity),
                     edm.multiplicity_to_str(newnp.to_end.multiplicity))
    if backlinks:
        old_backname = new_backname = None
        if oldnp.backLink is not None:
            old_backname = oldnp.backLink.name
        if newnp.backLink is not None:
            new_backname = oldnp.backLink.name
        if old_backname != new_backname:
            logging.info("%s.%s Navigation back link changed from %s to %s",
                         oldnp.parent.name, oldnp.name,
                         old_backname, new_backname)
Example #2
0
def navdiff(oldnp, newnp, backlinks=False):
    if oldnp.to_end.type != newnp.to_end.type:
        logging.info("%s.%s Navigation target type changed from %s to %s",
                     oldnp.parent.name, oldnp.name, oldnp.to_end.type,
                     newnp.to_end.type)
    if oldnp.to_end.multiplicity != newnp.to_end.multiplicity:
        logging.info(
            "%s.%s Navigation target multiplicity changed "
            "from %s to %s", oldnp.parent.name, oldnp.name,
            edm.multiplicity_to_str(oldnp.to_end.multiplicity),
            edm.multiplicity_to_str(newnp.to_end.multiplicity))
    if backlinks:
        old_backname = new_backname = None
        if oldnp.backLink is not None:
            old_backname = oldnp.backLink.name
        if newnp.backLink is not None:
            new_backname = oldnp.backLink.name
        if old_backname != new_backname:
            logging.info("%s.%s Navigation back link changed from %s to %s",
                         oldnp.parent.name, oldnp.name, old_backname,
                         new_backname)
Example #3
0
def es_table(es, index_items):
    result = """<h3><a id=%(anchor)s>%(title)s</a></h3>
%(summary)s
%(description)s
<table class="typedef">
    <thead>
        <th>Name</th>
        <th>Type</th>
        <th>Multiplicity</th>
        <th>Description</th>
        <th>Notes</th>
    </thead>
    <tbody>%(body)s</tbody>
</table>"""
    params = {
        'anchor': xml.escape_char_data7(es.name, True),
        'title': '',
        'summary': '',
        'description': '',
        'body': ''}
    tb = []
    type = es.entityType
    if type.has_stream():
        params['title'] = (xml.escape_char_data7(es.name) +
                           " <em>(Media Resource)</em>")
    else:
        params['title'] = xml.escape_char_data7(es.name)
    typedoc = type.Documentation
    if typedoc is not None:
        if typedoc.Summary is not None:
            params['summary'] = (
                '<p class="summary">%s</p>' %
                xml.escape_char_data7(typedoc.Summary.get_value()))
        if typedoc.LongDescription is not None:
            params['description'] = (
                '<p class="description">%s</p>' %
                xml.escape_char_data7(typedoc.LongDescription.get_value()))
    for p in type.Property:
        if p.name in es.keys:
            tr = ['<tr class="key">']
        else:
            tr = ["<tr>"]
        link = '%s.%s' % (es.name, p.name)
        tr.append("<td><a id=%s>%s</a></td>" % (
            xml.EscapeCharData(link, True),
            xml.escape_char_data7(p.name)))
        index_items.append((p.name, link, "property of %s" % es.name))
        tr.append("<td>%s</td>" % xml.escape_char_data7(p.type))
        tr.append("<td>%s</td>" % ("Optional" if p.nullable else "Required"))
        summary = description = ""
        if p.Documentation is not None:
            if p.Documentation.Summary:
                summary = p.Documentation.Summary.get_value()
            if p.Documentation.LongDescription:
                description = p.Documentation.LongDescription.get_value()
        tr.append("<td>%s</td>" % xml.escape_char_data7(summary))
        tr.append("<td>%s</td>" % xml.escape_char_data7(description))
        tr.append("</tr>")
        tb.append(string.join(tr, ''))
    for np in type.NavigationProperty:
        tr = ['<tr class="navigation">']
        link = '%s.%s' % (es.name, np.name)
        tr.append("<td><a id=%s>%s</a></td>" % (
            xml.EscapeCharData(link, True),
            xml.escape_char_data7(np.name)))
        index_items.append((np.name, link, "navigation property of %s" %
                            es.name))
        tr.append("<td><em>%s</em></td>" %
                  xml.escape_char_data7(es.get_target(np.name).name))
        tr.append("<td>%s</td>" %
                  edm.multiplicity_to_str(np.to_end.multiplicity))
        summary = description = ""
        if np.Documentation is not None:
            if np.Documentation.Summary:
                summary = np.Documentation.Summary.get_value()
            if np.Documentation.LongDescription:
                description = np.Documentation.LongDescription.get_value()
        tr.append("<td>%s</td>" % xml.escape_char_data7(summary))
        tr.append("<td>%s</td>" % xml.escape_char_data7(description))
        tr.append("</tr>")
        tb.append(string.join(tr, ''))

    params['body'] = string.join(tb, '\n')
    return result % params