Re: Extending PyYAML loader with a custom tag

Ingy dot Net <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <CAHJtQJ4=cHq861ef4afG+eqzPz_HSeW1+Q=r4fAVtdu9b8+aGA@mail.gmail.com>
Hmm. You might be able to make it work with one of these two:

--- !include logging.yml
database:
     type: postgres

or:

---
database:
     type: postgres
--- !include logging.yml

YAML doesn't have an include feature. You are using type/tag hooks to
invent your own. Both of these seem pretty ugly to me. The first is
declaring the whole document to be of a type to get stuff added at that
level. The second is adding a second document to the stream.

This seems better done outside the YAML but you could also make up some
kind of 'smart comment' feature and code to support that

database:
     type: postgres
#%include logging.yml

Hope that helps, Ingy

On Fri, Oct 10, 2014 at 9:22 AM, John Anderson <[email protected]> wrote:

> I want to support the following syntax:
>
> database:
>      type: postgres
>
> !include logging.yml
>
> and this:
>
> database:
>      type: !include logging.yml
>
>
> I have been able to get the second one to work by declaring the following
> code:
>
> Loader.add_constructor('!includes', include_func)
>
> But I can't get the first example to work where it basically just appends
> logging.yml to the bottom of the file it is included in.
>
> Is this possible?
>
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Yaml-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/yaml-core
>
>

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.