Skip to content

Commit

Permalink
Update docs and release info
Browse files Browse the repository at this point in the history
  • Loading branch information
brunato committed Apr 6, 2021
1 parent efc059d commit d5e2ae1
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
CHANGELOG
*********

`v1.6.0`_ (2021-04-06)
======================
* XML data bindings and code generators are now considered stable
* Add arguments 'max_depth' and 'extra_validator' to validation methods
* Enhance decoding with 'value_hook' argument

`v1.5.3`_ (2021-03-14)
======================
* Remove unnecessary bindings with schema proxy from ElementPathMixin
Expand Down Expand Up @@ -423,3 +429,4 @@ v0.9.6 (2017-05-05)
.. _v1.5.1: https://github.com/brunato/xmlschema/compare/v1.5.0...v1.5.1
.. _v1.5.2: https://github.com/brunato/xmlschema/compare/v1.5.1...v1.5.2
.. _v1.5.3: https://github.com/brunato/xmlschema/compare/v1.5.2...v1.5.3
.. _v1.6.0: https://github.com/brunato/xmlschema/compare/v1.5.3...v1.6.0
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ This library includes the following features:
* Support of XSD validation modes *strict*/*lax*/*skip*
* Remote attacks protection by default using an XMLParser that forbids entities
* XML data bindings based on DataElement class
* Static code generation with Jinja2 templates (experimental)
* Static code generation with Jinja2 templates


Installation
Expand Down
4 changes: 4 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Schema level API
.. autoattribute:: no_namespace_schema_location
.. autoattribute:: target_prefix
.. autoattribute:: default_namespace
.. autoattribute:: name
.. autoattribute:: url
.. autoattribute:: base_url
.. autoattribute:: root_elements
.. autoattribute:: simple_types
Expand Down Expand Up @@ -186,8 +188,10 @@ XML resources API

.. autoattribute:: root
.. autoattribute:: text
.. autoattribute:: name
.. autoattribute:: url
.. autoattribute:: base_url
.. autoattribute:: filepath
.. autoattribute:: namespace

.. automethod:: parse
Expand Down
7 changes: 2 additions & 5 deletions doc/extras.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@ impact on the base configuration.

.. _code-generators:

Code generation with Jinja2 templates (experimental)
====================================================
Code generation with Jinja2 templates
=====================================

The module *xmlschema.extras.codegen* provides an abstract base class
:class:`AbstractGenerator` for generate source code from parsed XSD
schemas. The Jinja2 engine is embedded in that class and empowered
with a set of custom filters and tests for accessing to defined XSD
schema components.

.. note::
This extra feature is still in experimental stage.


Schema based filters
--------------------
Expand Down
2 changes: 1 addition & 1 deletion publiccode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publiccodeYmlVersion: '0.2'
name: xmlschema
url: 'https://github.com/sissaschool/xmlschema'
landingURL: 'https://github.com/sissaschool/xmlschema'
releaseDate: '2021-03-xx'
releaseDate: '2021-04-06'
softwareVersion: v1.6.0
developmentStatus: stable
platforms:
Expand Down
15 changes: 9 additions & 6 deletions xmlschema/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,17 @@ def text(self):
"""The XML text source, `None` if it's not available."""
return self._text

@property
def name(self):
"""
The source name, is `None` if the instance is created from an Element or a string.
"""
return os.path.basename(self._url) if self.url else None

@property
def url(self):
"""
The source URL, `None` if the instance is created from an Element tree or from a string.
The source URL, `None` if the instance is created from an Element or a string.
"""
return self._url

Expand All @@ -423,17 +430,13 @@ def base_url(self):
@property
def filepath(self):
"""
The source filepath if the intance is created from a local file, `None` otherwise.
The resource filepath if the intance is created from a local file, `None` otherwise.
"""
if self._url:
url_parts = urlsplit(self._url)
if url_parts.scheme in ('', 'file'):
return url_parts.path

@property
def name(self):
return os.path.basename(self._url) if self.url else None

@property
def allow(self):
"""The security mode for accessing resource locations."""
Expand Down
11 changes: 6 additions & 5 deletions xmlschema/validators/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,6 @@ def __reversed__(self):
def __len__(self):
return len(self.elements)

@property
def name(self):
return os.path.basename(self.url) if self.url else None

@property
def xpath_proxy(self):
return XMLSchemaProxy(self)
Expand All @@ -529,9 +525,14 @@ def get_text(self):
"""Returns the source text of the XSD schema."""
return self.source.get_text()

@property
def name(self):
"""Schema resource name, is `None` if the schema is built from an Element or a string."""
return self.source.name

@property
def url(self):
"""Schema resource URL, is `None` if the schema is built from a string."""
"""Schema resource URL, is `None` if the schema is built from an Element or a string."""
return self.source.url

@property
Expand Down

0 comments on commit d5e2ae1

Please sign in to comment.