[ubuntu-it-www] Re: Problema sulle news

Fabio Marzocca thesaltydog at gmail.com
Fri May 21 11:12:53 BST 2010


Ho dato un'ochiata al feed delle Newsletter, ma mi pare corretto:

http://www.ubuntu-it.org/index.php?mact=CGFeedMaker,cntnt01,default,0&cntnt01feed=newsletterFeed&cntnt01showtemplate=false&cntnt01return.rss



2010/5/20 Leo Iannacone <leo.iannacone at gmail.com>:
> Il giorno gio, 20/05/2010 alle 16.18 +0200, Leo Iannacone ha scritto:
>> Il 20 maggio 2010 14.23, Fabio Marzocca <thesaltydog at gmail.com> ha scritto:
>> > A me pare che adesso dal planet si accede bene alle news del sito.
>>
>> Planet via web sì.
>>
>> Planet via feed no... Ci vuole uno script sul server che fa il replace
>> dei '&amp;' con '&'.
>
>
>
> Per ora risolvo con questo script che ho messo nel cronjob sul server.
>
> Praticamente macina tutti i file (vedi "files") generati dal planet alla
> ricerca di '&amp;amp;' e lo sostituisce con '&amp;'.
>
>
> Così risolviamo temporaneamente.
>
> Ma resta il fatto che bisogna capire cosa c'è che non va nel sito.
>
>
>
> #!/usr/bin/env python
>
> # This script is used to fix uris from
> # ubuntu-it.org website News feed
> # replacing '&amp;amp;' with '&amp;'
>
> from re import findall
> from re import MULTILINE
>
> base = '/srv/planet.ubuntu-it.org/www/'
> files = [
>  'atom.xml',
>  'foafroll.xml',
>  'index.html',
>  'opml.xml',
>  'rss10.xml',
>  'rss20.xml'
> ]
>
> # Pattern
> url_base = "http://www.ubuntu-it.org/index.php?mact=News"
>
> for f in files:
> #  print ("Opening %s..." % f)
>  absolute = base + f
>  fd = open(absolute, 'r')
>  data = fd.read()
>  fd.close()
>  urls = findall(url_base.replace('?','\?') + "(.*)", data, MULTILINE)
>  for url in urls:
>    fix = url.replace('&amp;amp;', '&amp;')
>    data = data.replace(url_base + url, url_base + fix)
>
>  fd = open(absolute, 'w')
>  fd.write(data)
>  fd.close()
>
>
>
>



More information about the Gruppo-web mailing list