pcreate: Uppercase version of the package name?

34 views
Skip to first unread message

Torsten Irländer

unread,
Nov 5, 2014, 7:06:12 AM11/5/14
to pylons...@googlegroups.com
Hi all,

I am using scaffolds to create templates for application extensions.
While rendering the scaffold I create some classes in a model file. For this it would be nice to have the package name ( {{package}} ) available not only in a lowercase version but also in a capitalised form.

Before creating an issue and maybe a patch on github: Is there a chance to get such a behavior added to the pcreate command? Maybe make the value available under the name {{Package}}? Or do you know a good workaround for this?

Torsten



Torsten Irländer

unread,
Nov 5, 2014, 7:09:00 AM11/5/14
to pylons...@googlegroups.com
To be precise as the initial subject is wrong. I need the capitalized form of the package name. So the package name "foo" becomes "Foo".

Jonathan Vanasco

unread,
Nov 20, 2014, 6:42:46 PM11/20/14
to pylons...@googlegroups.com
You might be able to use the "Project" variable, if you pass in a Capitalized form

$ pcreate --scaffold starter Foo
> 'project': Foo,
> 'package': foo,

Note that this doesn't "Capitalize" the name.  it keeps it as-is:

$ pcreate --scaffold starter FooBarBash
> 'project': FooBarBash,
> 'package': foobarbash,


Otherwise you'd have to patch or monkeypatch pcreate.py in order to do that:


Torsten Irländer

unread,
Nov 25, 2014, 3:30:48 AM11/25/14
to pylons...@googlegroups.com
Thanks for the reply Jonathan,

I knew the "project" variable, but as you mention is keeps the name is it was entered. Well I think I will monkeypatch this one for my need.

But how is the common workflow if I want to get this upstream?
1. Create an Issue
2. Patch
3. Pull-Request?

Torsten

--
You received this message because you are subscribed to a topic in the Google Groups "pylons-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pylons-devel/umFqVR6KmKo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pylons-devel...@googlegroups.com.
To post to this group, send email to pylons...@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.

Jonathan Vanasco

unread,
Nov 25, 2014, 11:14:06 AM11/25/14
to pylons...@googlegroups.com
I would create an Issue and propose it on the Github.  One of the core maintainers will say something like "Great!", "Maybe..." or  "No way".  I've seen (and personally gotten) a lot more "No Way" than "Okay" for proposed changes.

This is such an edge case though, that I don't know if they'll go for it "as-is".  Why would other people need or use this?  I don't see it getting added unless you can come up with a compelling reason.

This is purely a guess - but I think you might have better luck proposing it as some sort of "hook" for pcreate.  i.e., if there was some way to pass in other template variables to pcreate.  


Michael Merickel

unread,
Nov 25, 2014, 11:51:11 AM11/25/14
to pylons-devel
AFAIK all of the things you are asking for are possible using the
(documented) scaffolding API. You basically just subclass
``PyramidTemplate`` and override ``pre`` to mutate the ``vars`` and
add what you like.

http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/scaffolding.html

http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/api/scaffolds.html#pyramid.scaffolds.PyramidTemplate.pre
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Torsten Irländer

unread,
Nov 28, 2014, 4:55:13 AM11/28/14
to pylons...@googlegroups.com
A great! Thank you Michael for the hint. It works perfect for me.

You received this message because you are subscribed to a topic in the Google Groups "pylons-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pylons-devel/umFqVR6KmKo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pylons-devel...@googlegroups.com.

Torsten Irländer

unread,
Nov 28, 2014, 4:58:12 AM11/28/14
to pylons...@googlegroups.com
2014-11-25 17:14 GMT+01:00 Jonathan Vanasco <jona...@findmeon.com>:
I would create an Issue and propose it on the Github.  One of the core maintainers will say something like "Great!", "Maybe..." or  "No way".  I've seen (and personally gotten) a lot more "No Way" than "Okay" for proposed changes.

This is such an edge case though, that I don't know if they'll go for it "as-is".  Why would other people need or use this?  I don't see it getting added unless you can come up with a compelling reason.

Jonathan , Thank you for your answer. As Michael writes there is no need for me to change anything in the pcreate command.
Reply all
Reply to author
Forward
0 new messages