Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-18 Thread Christopher Arndt
On 11 Feb., 15:47, js [EMAIL PROTECTED] wrote:
 I'm looking for RSS/ATOM generator I can use in Python.
 I searched on pypi and the other places but I couldn't find any
 options on this. (I found many parsers, though)
 Is there any de-fact standard RSS/ATOM generator? (especially, I'd
 like to create Atom's)
 Do I have to do it myself from scratch?

You didn't specify your use case very much. If you just want to add
support for generating Atom/RSS feeds to your app and the format (i.e.
which elements and attributes are used) isn't too dynamic, you could
just an XML-templating language like Kid or Genshi.

The feed generator included in TurboGears uses this approach. I
recently packaged this as a separate module:

   http://chrisarndt.de/projects/turbofeeds/

The module still only makes sense in a TurboGears context but you may
want to look at the Kid templates used, they could be used by any app
that wants to generate Atom/RSS:

http://trac.turbogears.org/browser/projects/TurboFeeds/trunk/turbofeeds/templates

Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread Torsten Bronger
Hallöchen!

Stefan Behnel writes:

 Torsten Bronger wrote:

 Terran Melconian writes:
 
 [...]
 
 Maybe I understand you wrongly but there *is* a general XML
 generator with ElementTree.  I wouldn't generate XML directly but
 using ElementTree to generate Atom.  I did it myself three months
 ago and it was really trivial.

 Actually, there's tons of XML generator packages (most of them
 single Python modules), ElementTree itself and the E factory
 being only two of them.

I mentioned ElementTree because in my opinion, it is the only sane
XML generator in the standard lib.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
   (See http://ime.webhop.org for further contact info.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread js
Trivial?
More than XML::Atom::Feed?
http://search.cpan.org/~miyagawa/XML-Atom-0.28/lib/XML/Atom/Feed.pm

On 2/14/08, Torsten Bronger [EMAIL PROTECTED] wrote:
 Hallöchen!


  Terran Melconian writes:

   On 2008-02-11, js [EMAIL PROTECTED] wrote:
  
   Is there any de-fact standard RSS/ATOM generator? (especially,
   I'd like to create Atom's) Do I have to do it myself from
   scratch?
  
   I looked into similar issues about six months ago.  My conclusion
   was that generally XML generation libraries (unlike parsers) don't
   get written, because there's little enough to them that it isn't
   seen as worth doing, and that accepted practice is to just do it
   yourself.


 Maybe I understand you wrongly but there *is* a general XML
  generator with ElementTree.  I wouldn't generate XML directly but
  using ElementTree to generate Atom.  I did it myself three months
  ago and it was really trivial.

  Tschö,
  Torsten.


  --
  Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: [EMAIL PROTECTED]
(See http://ime.webhop.org for further contact info.)

 --
  http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread Torsten Bronger
Hallöchen!

js writes:

 Trivial?
 More than XML::Atom::Feed?
 http://search.cpan.org/~miyagawa/XML-Atom-0.28/lib/XML/Atom/Feed.pm

Excerpt from my code:

root = ElementTree.Element(feed, xmlns=http://www.w3.org/2005/Atom;)
ElementTree.SubElement(root, id).text = self.id
ElementTree.SubElement(root, title).text = self.title
ElementTree.SubElement(root, updated).text = format_time(self.updated)

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
   (See http://ime.webhop.org for further contact info.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread Stefan Behnel
Torsten Bronger wrote:
 js writes:
 
 Trivial?
 More than XML::Atom::Feed?
 http://search.cpan.org/~miyagawa/XML-Atom-0.28/lib/XML/Atom/Feed.pm
 
 Excerpt from my code:
 
 root = ElementTree.Element(feed, xmlns=http://www.w3.org/2005/Atom;)
 ElementTree.SubElement(root, id).text = self.id
 ElementTree.SubElement(root, title).text = self.title
 ElementTree.SubElement(root, updated).text = format_time(self.updated)

Look at the bottom of this page for an RSS example using the E factory:

http://effbot.org/zone/element-builder.htm

I find it much more readable than the above code, especially if you use the
version that comes with lxml.objectify, which has better support for
namespaces and data types:

http://codespeak.net/lxml/objectify.html#tree-generation-with-the-e-factory

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread Torsten Bronger
Hallöchen!

Stefan Behnel writes:

 Torsten Bronger wrote:

 [...]
 
 Excerpt from my code:
 
 root = ElementTree.Element(feed, xmlns=http://www.w3.org/2005/Atom;)
 ElementTree.SubElement(root, id).text = self.id
 ElementTree.SubElement(root, title).text = self.title
 ElementTree.SubElement(root, updated).text = format_time(self.updated)

 Look at the bottom of this page for an RSS example using the E factory:

 http://effbot.org/zone/element-builder.htm

 I find it much more readable than the above code, especially if you use the
 version that comes with lxml.objectify, which has better support for
 namespaces and data types:

 http://codespeak.net/lxml/objectify.html#tree-generation-with-the-e-factory

If you have more complex tasks, all this may be true; however,
generating Atom is just *so* simple that I prefer the version which
works without tweaking and further dependencies.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
   (See http://ime.webhop.org for further contact info.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread Stefan Behnel
Torsten Bronger wrote:
 Stefan Behnel writes:
 
 Torsten Bronger wrote:

 [...]

 Excerpt from my code:

 root = ElementTree.Element(feed, xmlns=http://www.w3.org/2005/Atom;)
 ElementTree.SubElement(root, id).text = self.id
 ElementTree.SubElement(root, title).text = self.title
 ElementTree.SubElement(root, updated).text = format_time(self.updated)

 Look at the bottom of this page for an RSS example using the E factory:

 http://effbot.org/zone/element-builder.htm
[...]
 If you have more complex tasks, all this may be true; however,
 generating Atom is just *so* simple that I prefer the version which
 works without tweaking and further dependencies.

The E factory is a small module with one main class. Adding that to your code
base doesn't give you any dependencies...

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread Torsten Bronger
Hallöchen!

Stefan Behnel writes:

 [...]

 The E factory is a small module with one main class. Adding that
 to your code base doesn't give you any dependencies...

Yes, but just for creating five elements?  ;-)

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
   (See http://ime.webhop.org for further contact info.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-14 Thread js
Great...
I guess I should have learned more about ElementTree.
In anyway, Thanks all. You all convinced me, really.


On 2/14/08, Stefan Behnel [EMAIL PROTECTED] wrote:
 Torsten Bronger wrote:
   js writes:
  
   Trivial?
   More than XML::Atom::Feed?
   http://search.cpan.org/~miyagawa/XML-Atom-0.28/lib/XML/Atom/Feed.pm
  
   Excerpt from my code:
  
   root = ElementTree.Element(feed, xmlns=http://www.w3.org/2005/Atom;)
   ElementTree.SubElement(root, id).text = self.id
   ElementTree.SubElement(root, title).text = self.title
   ElementTree.SubElement(root, updated).text = 
 format_time(self.updated)


 Look at the bottom of this page for an RSS example using the E factory:

  http://effbot.org/zone/element-builder.htm

  I find it much more readable than the above code, especially if you use the
  version that comes with lxml.objectify, which has better support for
  namespaces and data types:


  http://codespeak.net/lxml/objectify.html#tree-generation-with-the-e-factory

  Stefan

 --
  http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-13 Thread Terran Melconian
On 2008-02-11, js [EMAIL PROTECTED] wrote:
 Is there any de-fact standard RSS/ATOM generator? (especially, I'd
 like to create Atom's)
 Do I have to do it myself from scratch?

I looked into similar issues about six months ago.  My conclusion was
that generally XML generation libraries (unlike parsers) don't get
written, because there's little enough to them that it isn't seen as
worth doing, and that accepted practice is to just do it yourself.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-13 Thread Torsten Bronger
Hallöchen!

Terran Melconian writes:

 On 2008-02-11, js [EMAIL PROTECTED] wrote:

 Is there any de-fact standard RSS/ATOM generator? (especially,
 I'd like to create Atom's) Do I have to do it myself from
 scratch?

 I looked into similar issues about six months ago.  My conclusion
 was that generally XML generation libraries (unlike parsers) don't
 get written, because there's little enough to them that it isn't
 seen as worth doing, and that accepted practice is to just do it
 yourself.

Maybe I understand you wrongly but there *is* a general XML
generator with ElementTree.  I wouldn't generate XML directly but
using ElementTree to generate Atom.  I did it myself three months
ago and it was really trivial.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: [EMAIL PROTECTED]
   (See http://ime.webhop.org for further contact info.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-13 Thread Stefan Behnel
Torsten Bronger wrote:
 Terran Melconian writes:
 
 On 2008-02-11, js [EMAIL PROTECTED] wrote:

 Is there any de-fact standard RSS/ATOM generator? (especially,
 I'd like to create Atom's) Do I have to do it myself from
 scratch?
 I looked into similar issues about six months ago.  My conclusion
 was that generally XML generation libraries (unlike parsers) don't
 get written, because there's little enough to them that it isn't
 seen as worth doing, and that accepted practice is to just do it
 yourself.
 
 Maybe I understand you wrongly but there *is* a general XML
 generator with ElementTree.  I wouldn't generate XML directly but
 using ElementTree to generate Atom.  I did it myself three months
 ago and it was really trivial.

Actually, there's tons of XML generator packages (most of them single Python
modules), ElementTree itself and the E factory being only two of them.

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-13 Thread Canarix
Hi,

On Mon, Feb 11, 2008 at 3:47 PM, js [EMAIL PROTECTED] wrote:
 Hi,

  I'm looking for RSS/ATOM generator I can use in Python.
  I searched on pypi and the other places but I couldn't find any
  options on this. (I found many parsers, though)
  Is there any de-fact standard RSS/ATOM generator? (especially, I'd
  like to create Atom's)
  Do I have to do it myself from scratch?

You can look at PyRSS2Gen which works fine for me :
http://www.dalkescientific.com/Python/PyRSS2Gen.html

But it only works with RSS2.

Bye,
CanariX


  Thanks in advance.
  --
  http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any Generic RSS/ATOM generator in Python?

2008-02-11 Thread Stefan Behnel
js wrote:
 I'm looking for RSS/ATOM generator I can use in Python.
 I searched on pypi and the other places but I couldn't find any
 options on this. (I found many parsers, though)
 Is there any de-fact standard RSS/ATOM generator? (especially, I'd
 like to create Atom's)
 Do I have to do it myself from scratch?

Try googling for python atom, gives me this as first hit:

http://www.imc.org/atom-syntax/mail-archive/msg18662.html

But since it's not that hard to generate XML in general, maybe these are also
worth another look:

http://blog.ianbicking.org/2007/08/02/atom-models/
http://codespeak.net/lxml/objectify.html#tree-generation-with-the-e-factory

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list


Is there any Generic RSS/ATOM generator in Python?

2008-02-11 Thread js
Hi,

I'm looking for RSS/ATOM generator I can use in Python.
I searched on pypi and the other places but I couldn't find any
options on this. (I found many parsers, though)
Is there any de-fact standard RSS/ATOM generator? (especially, I'd
like to create Atom's)
Do I have to do it myself from scratch?

Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list