Cool!

0 views
Skip to first unread message

infobank

unread,
Dec 16, 2007, 3:32:41 PM12/16/07
to pycoon-users
Hello, I found your project today, looks great. I'm the maintainer of
nexista, a php-based web framework which has many similar features to
cocoon like the sitemap, xml, xslt stuff, but a different sitemap
schema (though I may work to have them conform in the future).

I was thinking about a python version, lo and behold you've done it!
Just wanted to say hi today, I'll write more questions once I have
some time to dig in. Today I'm digging into popoon (a php cocoon
compliant framework) to learn more about the cocoon sitemap syntax.

Andrey Nordin

unread,
Dec 16, 2007, 5:48:14 PM12/16/07
to pycoon...@googlegroups.com
infobank wrote:

> I was thinking about a python version, lo and behold you've done it!
> Just wanted to say hi today, I'll write more questions once I have
> some time to dig in. Today I'm digging into popoon (a php cocoon
> compliant framework) to learn more about the cocoon sitemap syntax.

Hi Albert! Thanks for your message. I'm glad you've found our project. Looking
forward to receiving questions and feedback from you :)

Although I'm the main developer of Pycoon, I like neither 0.2a5 nor the
Subversion trunk, because my vision is already beyond that architecture
(meanwhile I've got it running in a production environment for one project).
Unfortunately, Pycoon is not being developed actively since 2007-08. I don't
have enough time for this project as I'm working hard for my current employer.
I've got many ideas to develop it further, but I don't know when I'll be able to
continue with it.

P. S. I'll take a look at Nexista, but I'm not very comfortable with PHP ;) Hope
you've got some docs, not only the code :)

--
Best regards,
Andrey Nordin

Web Identity: <http://claimid.com/anrienord>
IM: <xmpp:anri...@jabber.org>

Albert Lash

unread,
Dec 16, 2007, 7:10:47 PM12/16/07
to pycoon...@googlegroups.com
Hi Andrey,

I was able to get pycoon up and running with cherrypy, so far so
good. I put my notes up here:

http://www.docunext.com/wiki/Pycoon

The Nexista docs are here:

http://www.docs.nexista.org/

and

http://www.nexista.org/wiki/Main_Page

I'm mainly interested to try libxslt from python, do you know if
that's possible with pycoon?

Thanks,

Albert

--
My Blogs:
http://www.docunext.com/
http://www.albertlash.com/

Andrey Nordin

unread,
Dec 16, 2007, 8:33:34 PM12/16/07
to pycoon...@googlegroups.com
Albert Lash wrote:

> I was able to get pycoon up and running with cherrypy, so far so
> good. I put my notes up here:
>
> http://www.docunext.com/wiki/Pycoon
>
> The Nexista docs are here:
>
> http://www.docs.nexista.org/

> http://www.nexista.org/wiki/Main_Page

Thanks for the links!

> I'm mainly interested to try libxslt from python, do you know if
> that's possible with pycoon?

Yes, of course it's possible. Pycoon uses a library named lxml
<http://codespeak.net/lxml/>, a Python binding for libxml2 and libxslt that has
an ElementTree compatible API. The <map:transform type="xslt"> element is based
on this library. See the sources of pycoon.components.cocoon.TraxTransformer in
Pycoon.

Here are some links for you:

* XSLT support in lxml <http://codespeak.net/lxml/xpathxslt.html#xslt>
* XSLT transformer in Apache Cocoon
<http://cocoon.apache.org/2.1/userdocs/default/xslt-transformer.html>

I saw your <http://www.docunext.com/wiki/Python> page. You might be interested
in Django framework <http://www.djangoproject.com/>. The framework is definitely
not so conceptual as Apache Cocoon, but it is lightweight and allows clear
separation between logic and presentation. It follows the MVC design pattern
adapted to web development domain, so does Apache Cocoon. In Cocoon, MVC is
implemented as XML and SAX-like events for models, transformers + serializers
for views, matchers + conditions + actions for controllers. But in Django, it is
done as ORM or just Python objects for models, view functions + templates for
views and URLconfs + logic inside view functions for controllers.

Albert Lash

unread,
Dec 16, 2007, 8:42:45 PM12/16/07
to pycoon...@googlegroups.com
> Yes, of course it's possible. Pycoon uses a library named lxml
> <http://codespeak.net/lxml/>, a Python binding for libxml2 and libxslt that has
> an ElementTree compatible API. The <map:transform type="xslt"> element is based
> on this library. See the sources of pycoon.components.cocoon.TraxTransformer in
> Pycoon.
>

Awesome. I thought lxml was instead of libxml2 and libxslt.

> Here are some links for you:
>
> * XSLT support in lxml <http://codespeak.net/lxml/xpathxslt.html#xslt>
> * XSLT transformer in Apache Cocoon
> <http://cocoon.apache.org/2.1/userdocs/default/xslt-transformer.html>
>

Thanks!

> I saw your <http://www.docunext.com/wiki/Python> page. You might be interested
> in Django framework <http://www.djangoproject.com/>. The framework is definitely
> not so conceptual as Apache Cocoon, but it is lightweight and allows clear
> separation between logic and presentation. It follows the MVC design pattern
> adapted to web development domain, so does Apache Cocoon. In Cocoon, MVC is
> implemented as XML and SAX-like events for models, transformers + serializers
> for views, matchers + conditions + actions for controllers. But in Django, it is
> done as ORM or just Python objects for models, view functions + templates for
> views and URLconfs + logic inside view functions for controllers.

Yeah I've heard of django but never actually used it. Guess now is as
good a time as any, but I'm very interested in pycoon because I have
several applications (like http://www.pbooks.org/blog/ ) developed
within Nexista which I'd like to chart various future paths for, and
Cocoon sitemaps are the most similar to Nexista sitemaps as far as I
can tell.

Albert Lash

unread,
Dec 30, 2007, 10:50:58 PM12/30/07
to pycoon...@googlegroups.com
Hi Andrey,

I worked some more with pycoon recently and was able to dig into the
XML / XSL examples you've setup. I also read more about cocoon and I'm
thinking of porting the apps I've written for nexista to cocoon, which
shouldn't be too hard, as nexista is sort of a subset of cocoon's
capabilities. As I ponder that, I'm hacking away at pycoon to learn
more about how python works. Along those lines, I really like this
WSGI I'm learning about.

Since you haven't been working on pycoon for awhile, are you ever
planning to return to it?

- Albert

--

Andrey Nordin

unread,
Jan 1, 2008, 7:48:14 PM1/1/08
to pycoon...@googlegroups.com
Hi Albert,

> Since you haven't been working on pycoon for awhile, are you ever
> planning to return to it?

Yes, I've got some ideas for developing Pycoon further and I'm quite
sure I'll have some time to continue the project. Nevertheless its
current priority is really low. But I'm ready to discuss issues
related to its development.

Albert Lash

unread,
Jan 1, 2008, 9:37:30 PM1/1/08
to pycoon...@googlegroups.com
Hi Andrey,

> Yes, I've got some ideas for developing Pycoon further and I'm quite
> sure I'll have some time to continue the project. Nevertheless its
> current priority is really low. But I'm ready to discuss issues
> related to its development.

OK, cool. Here are some notes I took while exploring:

The pycoon process:
1. pycoon/__init__.py - main()
2. pycoon/wsgi/cherrypyserver.py - pycoonFactory()
3. pycoon/wsgi/__init__.py __init__
4. pycoon/wsgi/__init__.py __call__
5. pycoon/wsgi/__init__.py process
6. pycoon/environment.py - why environment? is it used for mount? or
for mapping to the filesystem?

The initialization process seems a little bit confusing, but that
might be because I'm new to python. I did a bunch of tests and stuff
seems to work well. Can you give an example of what an action would
look like? In nexista I'd do something like this:

<map:action type="redirect" params="/new-url/"/>

Would data sources be accessed via action components? And what about
python scripts? Would it be possible to include a script in a pipeline
match? In nexista I'd do this:

<map:script src="lib/simple_script.php"/>

Thanks,

Albert

Andrey Nordin

unread,
Jan 3, 2008, 7:24:39 AM1/3/08
to pycoon...@googlegroups.com
Hi Albert,

> OK, cool. Here are some notes I took while exploring:
>
> The pycoon process:
> 1. pycoon/__init__.py - main()
> 2. pycoon/wsgi/cherrypyserver.py - pycoonFactory()
> 3. pycoon/wsgi/__init__.py __init__
> 4. pycoon/wsgi/__init__.py __call__
> 5. pycoon/wsgi/__init__.py process
> 6. pycoon/environment.py - why environment? is it used for mount? or
> for mapping to the filesystem?

The environment here is something similar to the WSGI environ
dictionary. By the way, I'm not quite sure if you've looked through
the UML diagrams in the Developer's guide
<http://pycoon.pbwiki.com/Developer+guide>. They may be helpful.

> The initialization process seems a little bit confusing, but that
> might be because I'm new to python. I did a bunch of tests and stuff
> seems to work well.

To make some things clear, I've ported the request processing
architecture from Apache Cocoon. So the overall design is still quite
Java-ish. In v0.3 I had planned to align the design with the WSGI
paradigm, i. e. turn many processing blocks into WSGI middleware and
change the Inversion of Control container to make it more pythonic.
See my post <http://abstracthack.wordpress.com/2007/07/01/some-pycoon-activities/>
about v0.3 for more details. But as for now, I'm not quite sure that a
bunch of WSGI callables is the best way of organizing a web framework
(I'm exploring the Django land). Nevertheless I find WSGI middleware
quite useful for a certain kind of tasks. See my wsgistraw library
<http://abstracthack.wordpress.com/wsgistraw/> as an example of some
nice things done in the WSGI way.

> Can you give an example of what an action would
> look like? In nexista I'd do something like this:
>
> <map:action type="redirect" params="/new-url/"/>

Huh, an example of action... :) You could follow the actions guide
<http://cocoon.apache.org/2.1/userdocs/actions.html> in the Cocoon
docs. Personally, I use actions for sending emails via web forms. And
redirects are handled in both Cocoon and Pycoon by a special element
named <map:redirect-to>.

> Would data sources be accessed via action components?

Well, CRUD operations are done in the following way. Cocoon uses
various <map:generator>s for getting the data and something like
SourceWritingTransformer
<http://cocoon.apache.org/2.1/userdocs/sourcewriting-transformer.html>
for all the other operations.

> And what about python scripts? Would it be possible to include a script in a pipeline
> match? In nexista I'd do this:
>
> <map:script src="lib/simple_script.php"/>

What do you mean by Python script? It's quite uncommon to use
module-level application logic statements in Python (the opposite is
true in PHP). You could wrap your logic into an <map:action> or
<map:transformer>, for example. In Pycoon, you might inherit your
logic class from Action or Transformer from pycoon.components.

Albert Lash

unread,
Jan 3, 2008, 5:15:55 PM1/3/08
to pycoon...@googlegroups.com
> The environment here is something similar to the WSGI environ
> dictionary. By the way, I'm not quite sure if you've looked through
> the UML diagrams in the Developer's guide
> <http://pycoon.pbwiki.com/Developer+guide>. They may be helpful.

Yes I review them after I sent the email, I see its in the plan to
remove the Environment module in lieu of the environ dict.

>
> > The initialization process seems a little bit confusing, but that
> > might be because I'm new to python. I did a bunch of tests and stuff
> > seems to work well.
>
> To make some things clear, I've ported the request processing
> architecture from Apache Cocoon. So the overall design is still quite
> Java-ish. In v0.3 I had planned to align the design with the WSGI
> paradigm, i. e. turn many processing blocks into WSGI middleware and
> change the Inversion of Control container to make it more pythonic.
> See my post <http://abstracthack.wordpress.com/2007/07/01/some-pycoon-activities/>
> about v0.3 for more details. But as for now, I'm not quite sure that a
> bunch of WSGI callables is the best way of organizing a web framework
> (I'm exploring the Django land). Nevertheless I find WSGI middleware
> quite useful for a certain kind of tasks. See my wsgistraw library
> <http://abstracthack.wordpress.com/wsgistraw/> as an example of some
> nice things done in the WSGI way.
>

Ahh, I am clueless when it comes to java. I think that I still need to
learn more about python and cocoon before I'm able to do anything with
or contribute to pycoon. I'm planning to port nexista to python, and
maybe adjust a few things to make it a little more cocoon-ish, but
keep the architecture the same. I'd like to make the sitemap formats
the same at least.

Best Regards,

Albert

Reply all
Reply to author
Forward
0 new messages