html in cherrypy code

View: New views
15 Messages — Rating Filter:   Alert me  

html in cherrypy code

by James-207 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


All,

I'm wondering if anyone knows of any good tutorials on the web that
describes how to properly integrate HTML in CherryPy code. As I write
my web application I obviously need to create a header and a 'body'
with HTML code. I haven't found any good documents online that
describes how to go about doing this.

Also, does anyone have any recommendations on a good 'beginner' book
for CherryPy? I'm very familiar with Python but am ramping up (slowly)
with CherryPy and could use a good read. The documentation / tutorial
on the CherryPy page was lacking a bit.

Thanks!
- james

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


There are a lot of python-based tricks you can use for outputting  
HTML, such as string formatting, or base classes that define headers  
and footers and are extended by other classes that define content, etc  
etc. But I've found that after two or three pages of this sort of  
stuff it's far easier just to learn one of the many python templating  
packages and use that. I use Jinja, because I'm accustomed to django's  
templates, but Cheetah, Genshi, Mako and Myghty and Evoque are all  
popular options. It's just a major pain to do it yourself, and the  
more you work on a nice re-usable system for outputting html, the  
closer you come to re-inventing one of the aforementioned templating  
packages :)

So far as I know, CherryPy Essentials (http://www.cherrypyessentials.com/ 
) is the only book out there...

Yours,
Eric

On Jun 25, 2008, at 7:58 AM, James wrote:

>
> All,
>
> I'm wondering if anyone knows of any good tutorials on the web that
> describes how to properly integrate HTML in CherryPy code. As I write
> my web application I obviously need to create a header and a 'body'
> with HTML code. I haven't found any good documents online that
> describes how to go about doing this.
>
> Also, does anyone have any recommendations on a good 'beginner' book
> for CherryPy? I'm very familiar with Python but am ramping up (slowly)
> with CherryPy and could use a good read. The documentation / tutorial
> on the CherryPy page was lacking a bit.
>
> Thanks!
> - james
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Jason Earl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


James <jtp@...> writes:

> All,
>
> I'm wondering if anyone knows of any good tutorials on the web that
> describes how to properly integrate HTML in CherryPy code. As I write
> my web application I obviously need to create a header and a 'body'
> with HTML code. I haven't found any good documents online that
> describes how to go about doing this.
>
> Also, does anyone have any recommendations on a good 'beginner' book
> for CherryPy? I'm very familiar with Python but am ramping up (slowly)
> with CherryPy and could use a good read. The documentation / tutorial
> on the CherryPy page was lacking a bit.
>
> Thanks!
> - james

I thought that Sylvain Hellegouarch's _CherryPy Essentials_ was quite
good.

http://www.packtpub.com/CherryPy/book

I especially like the chapters on web services and AJAX.  I'd worked on
projects that did some of this stuff before, but his examples showed me
lots of things that I could have done better.  If you are interested in
building websites with CherryPy and you aren't sure where to start, you
should start with _CherryPy Essentials_.

Jason

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Jonathan Mark-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I agree that Sylvain Hellegouarch's book on CherryPy is good. His
example in  the book uses the Kid templating engine.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by brahmaforces :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I use Mako templates and it is quite easy to integrate html with python using cherrry py. Initially there is a bit of a learning curve, however once you get it going, it flows along nicely...If you have any specific questions do post as I went through this learning curve as a complete newbie myself...\
Arjuna

 
On 6/25/08, jonathansamuel <jonathansamuel@...> wrote:

I agree that Sylvain Hellegouarch's book on CherryPy is good. His
example in  the book uses the Kid templating engine.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Jason Earl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


jonathansamuel <jonathansamuel@...> writes:

> I agree that Sylvain Hellegouarch's book on CherryPy is good. His
> example in  the book uses the Kid templating engine.

The nice thing about Sylvain's book is that he shows you how easy it is
to mix and match components in CherryPy.  For example, I have quite a
bit of experience with Zope Page Templates, and I didn't really want to
learn the ins and outs of another templating language just because I got
tired of trying to fit Zope into my head.  After reading Sylvain's Kid
examples I was able to integrate SimpleTAL in a similar manner.

In fact, choosing which templating language to use is much more
difficult than integrating your choice into CherryPy.  I swear someone
creates a new templating language for Python every 14 minutes.

Jason

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Robert Brewer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Jason Earl wrote:
> jonathansamuel <jonathansamuel@...> writes:
>
> > I agree that Sylvain Hellegouarch's book on CherryPy is good. His
> > example in  the book uses the Kid templating engine.
>
> The nice thing about Sylvain's book is that he shows you how easy it
is
> to mix and match components in CherryPy.  For example, I have quite a
> bit of experience with Zope Page Templates, and I didn't really want
to
> learn the ins and outs of another templating language just because I
> got tired of trying to fit Zope into my head.  After reading Sylvain's
> Kid examples I was able to integrate SimpleTAL in a similar manner.

Feel free to write that up on http://tools.cherrypy.org/wiki. :)

> In fact, choosing which templating language to use is much more
> difficult than integrating your choice into CherryPy.  I swear someone
> creates a new templating language for Python every 14 minutes.

Amen. And ugh.


Robert Brewer
fumanchu@...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by James-207 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks for the replies, everyone.

Is there a "best" templating system? Or is it a simple balance of
complexity vs flexibility and power?

Thanks!

On Wed, Jun 25, 2008 at 3:58 PM, Robert Brewer <fumanchu@...> wrote:

>
> Jason Earl wrote:
>> jonathansamuel <jonathansamuel@...> writes:
>>
>> > I agree that Sylvain Hellegouarch's book on CherryPy is good. His
>> > example in  the book uses the Kid templating engine.
>>
>> The nice thing about Sylvain's book is that he shows you how easy it
> is
>> to mix and match components in CherryPy.  For example, I have quite a
>> bit of experience with Zope Page Templates, and I didn't really want
> to
>> learn the ins and outs of another templating language just because I
>> got tired of trying to fit Zope into my head.  After reading Sylvain's
>> Kid examples I was able to integrate SimpleTAL in a similar manner.
>
> Feel free to write that up on http://tools.cherrypy.org/wiki. :)
>
>> In fact, choosing which templating language to use is much more
>> difficult than integrating your choice into CherryPy.  I swear someone
>> creates a new templating language for Python every 14 minutes.
>
> Amen. And ugh.
>
>
> Robert Brewer
> fumanchu@...
>
>
> >
>



--
"Do not meddle in the affairs of wizards, for they are subtle and
quick to anger."
 -Tolkien

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Lukasz Michalski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Wednesday 25 June 2008, James wrote:
> Thanks for the replies, everyone.
>
> Is there a "best" templating system? Or is it a simple balance of
> complexity vs flexibility and power?
>

I am new to cherrypy and python in general and after a little research I
decided to use genshi. I think that the biggest impact on my decision was
that there is excellent tutorial abount cherrypy and genshi.

Regards,
Łukasz


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Tim Roberts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

James wrote:
Is there a "best" templating system? Or is it a simple balance of
complexity vs flexibility and power?
  

In my not very humble opinion, the choice of a templating system is much more a matter of personal preference than it is about performance or complexity.  Seriously, unless you write a site that gets 500 hits a minute (and darned few of us will every do that), you don't need to think about performance.  Instead, you should try a simple project with a bunch of them, then use the one that makes the most sense to you.

I know a lot of people like the Zope TAL scheme.  I don't.  To me, it has always seemed excessively wordy and non-intuitive.  Now, I know that the TAL fans would disagree with my assessment (no need to write me), and that's just fine.  That's why there are so many choices.

For me, the Cheetah scheme has always seemed incredibly sensible.  Simple, quick, flexible, with a great blend of Python and HTML.  It lets me concentrate on making my pages look the way I want, without getting in the way.  Again, I know that many people think that Cheetah breaks the "separation of presentation and computation" rule too much, and that's fine.  I will keep getting my work done with Cheetah, while they get their work done with TAL.
-- 
Tim Roberts, timr@...
Providenza & Boekelheide, Inc.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Gerold Penz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Tim Roberts schrieb:
> For me, the Cheetah scheme has always seemed incredibly sensible.  
> Simple, quick, flexible, with a great blend of Python and HTML.

Hello!

I think, Cheetah is a very good choice! Because, it's simple to use for
simple tasks. And it's mighty enough to do powerful tasks. And your
template don´t look like a brace-storm. ;-)

(german) http://halvar.at/python/cherrypy_cheetah/

Regards,
Gerold
:-)

--
________________________________________________________________________
Gerold Penz - bcom - Programmierung
     http://halvar.at | http://sw3.at | http://bcom.at
Wissen hat eine wunderbare Eigenschaft:
     Es verdoppelt sich, wenn man es teilt.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by Jason Earl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


"Robert Brewer" <fumanchu@...> writes:

> Jason Earl wrote:
>> jonathansamuel <jonathansamuel@...> writes:
>>
>> > I agree that Sylvain Hellegouarch's book on CherryPy is good. His
>> > example in  the book uses the Kid templating engine.
>>
>> The nice thing about Sylvain's book is that he shows you how easy it
> is
>> to mix and match components in CherryPy.  For example, I have quite a
>> bit of experience with Zope Page Templates, and I didn't really want
> to
>> learn the ins and outs of another templating language just because I
>> got tired of trying to fit Zope into my head.  After reading Sylvain's
>> Kid examples I was able to integrate SimpleTAL in a similar manner.
>
> Feel free to write that up on http://tools.cherrypy.org/wiki. :)

I actually have a rough draft started.  I just need to finish it.  Part
of the problem is that while what I have got now is good enough for me.
It's not quite to the point where it is good enough for the rest of
y'all.

When I get to the point where my solution is as comprehensive as the
Jinja example, then I'll share :).

Jason

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by James-207 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Is there a good tutorial on integrating CherryPy + Cheetah? I haven't
found too much information, but maybe I'm simply dumb and need some
hand holding. ;)

- j

On Wed, Jun 25, 2008 at 7:20 PM, Gerold Penz <gerold.penz@...> wrote:

>
> Tim Roberts schrieb:
>> For me, the Cheetah scheme has always seemed incredibly sensible.
>> Simple, quick, flexible, with a great blend of Python and HTML.
>
> Hello!
>
> I think, Cheetah is a very good choice! Because, it's simple to use for
> simple tasks. And it's mighty enough to do powerful tasks. And your
> template don´t look like a brace-storm. ;-)
>
> (german) http://halvar.at/python/cherrypy_cheetah/
>
> Regards,
> Gerold
> :-)
>
> --
> ________________________________________________________________________
> Gerold Penz - bcom - Programmierung
>     http://halvar.at | http://sw3.at | http://bcom.at
> Wissen hat eine wunderbare Eigenschaft:
>     Es verdoppelt sich, wenn man es teilt.
>
> >
>



--
"Do not meddle in the affairs of wizards, for they are subtle and
quick to anger."
 -Tolkien

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by James-207 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Sorry, I guess I should have indicated that English is my preferred
language. :o)

On Sat, Jul 5, 2008 at 9:44 PM, James <jtp@...> wrote:

> Is there a good tutorial on integrating CherryPy + Cheetah? I haven't
> found too much information, but maybe I'm simply dumb and need some
> hand holding. ;)
>
> - j
>
> On Wed, Jun 25, 2008 at 7:20 PM, Gerold Penz <gerold.penz@...> wrote:
>>
>> Tim Roberts schrieb:
>>> For me, the Cheetah scheme has always seemed incredibly sensible.
>>> Simple, quick, flexible, with a great blend of Python and HTML.
>>
>> Hello!
>>
>> I think, Cheetah is a very good choice! Because, it's simple to use for
>> simple tasks. And it's mighty enough to do powerful tasks. And your
>> template don´t look like a brace-storm. ;-)
>>
>> (german) http://halvar.at/python/cherrypy_cheetah/
>>
>> Regards,
>> Gerold
>> :-)
>>
>> --
>> ________________________________________________________________________
>> Gerold Penz - bcom - Programmierung
>>     http://halvar.at | http://sw3.at | http://bcom.at
>> Wissen hat eine wunderbare Eigenschaft:
>>     Es verdoppelt sich, wenn man es teilt.
>>
>> >>
>>
>
>
>
> --
> "Do not meddle in the affairs of wizards, for they are subtle and
> quick to anger."
>  -Tolkien
>



--
"Do not meddle in the affairs of wizards, for they are subtle and
quick to anger."
 -Tolkien

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: html in cherrypy code

by crimsonPhantom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


here's a sample: http://rafb.net/p/TXuhBV22.html

you should be able to understand with that one snippet. Then head over
to the Cheetah Docs and read away.

On Jul 5, 9:44 pm, James <j...@...> wrote:

> Is there a good tutorial on integrating CherryPy + Cheetah? I haven't
> found too much information, but maybe I'm simply dumb and need some
> hand holding. ;)
>
> - j
>
>
>
> On Wed, Jun 25, 2008 at 7:20 PM, Gerold Penz <gerold.p...@...> wrote:
>
> > Tim Roberts schrieb:
> >> For me, the Cheetah scheme has always seemed incredibly sensible.
> >> Simple, quick, flexible, with a great blend of Python and HTML.
>
> > Hello!
>
> > I think, Cheetah is a very good choice! Because, it's simple to use for
> > simple tasks. And it's mighty enough to do powerful tasks. And your
> > template don´t look like a brace-storm. ;-)
>
> > (german)http://halvar.at/python/cherrypy_cheetah/
>
> > Regards,
> > Gerold
> > :-)
>
> > --
> > ________________________________________________________________________
> > Gerold Penz - bcom - Programmierung
> >    http://halvar.at|http://sw3.at|http://bcom.at
> > Wissen hat eine wunderbare Eigenschaft:
> >     Es verdoppelt sich, wenn man es teilt.
>
> --
> "Do not meddle in the affairs of wizards, for they are subtle and
> quick to anger."
>  -Tolkien
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price