[Nitro] [PATCH] ATOM serializer

Arne Brasseur arne at arnebrasseur.net
Sun Oct 21 09:51:52 EDT 2007


Hi,

This patch doesn't fix much but does two useful things:
- issue a warning if there is no model annotation on the controller
- check if the serialized object respond_to?(:author) before calling #author

 From looking at http://www.atomenabled.org/developers/syndication/ and 
at the W3C validator it seems the biggest issues are:
- id's should be complete IRI's (a superset of URI's). Relative URL's 
are not valid.
- the updated (timestamp) element is mandatory, both on the feed as on 
the entries

For the second thing I would assume this could be done to play nicely 
with 'is Timestamped' ?

As it stands this nice functionality is still undocumented, but for the 
adventurous this might help you get started:

class RandomController
  ann :self, :model => RandomThing

  def index
    @random_things = RandomThing.all
  end
end

class RandomThing
  attr :title, String
  attr :author, String

  def body
    "you need this method"
  end
end

app.dispatcher.root.random = RandomController

go to http://localhost:9000/random.atom

Have fun!

(ab)

Arne Brasseur schreef:
> Try the W3C validator: 
> http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.me.gr%2Fblog%2Findex.atom
>
> It reports a few issues that you might want to solve before doing more 
> testing.
>
> (ab)
>
> George Moschovitis schreef:
>> Dear devs,
>>
>> I am trying to make the atom serializer in raw/util/atom.rb work.
>> I create a new simpler (and faster) version. This seems to work with 
>> Google reader but It does not show any kind of summary
>> in Firefox (when viewing the feed).
>>
>> Here is an example:
>>
>> http://me.gr/blog/index.atom
>>
>> Can anyone on this list spot the problem(s) with this feed?
>>
>> Please help me debug this once and for all.
>>
>> thanks,
>> George.
>>
>>
>>
>> -- 
>> http://gmosx.me.gr
>> http://phidz.com
>> http://blog.gmosx.com
>> http://cull.gr
>> http://www.joy.gr
>> http://nitroproject.org
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Nitro-general mailing list
>> Nitro-general at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/nitro-general
>
>
> -- 
> Arne Brasseur
> http://www.arnebrasseur.net
> http://www.zhongwiki.com
> http://www.bankske.org
> arne at arnebrasseur.net
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general


-- 
Arne Brasseur
http://www.arnebrasseur.net
http://www.zhongwiki.com
http://www.bankske.org
arne at arnebrasseur.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20071021/b1fad854/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bundle_ab_20071021.patch
Type: text/x-patch
Size: 69571 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20071021/b1fad854/attachment-0001.bin 


More information about the Nitro-general mailing list