Simos Xenitellis | 13 Oct 20:35 2004
Picon
Picon

Re: Trimming feed content

On Mon, 2004-10-11 at 18:01, Miguel A Paraz wrote:
> Hi,
> Some blogs put the entire post in <description /> complete with HTML.
> What's a good way to trim this down and show a short excerpt?

Regarding Unicode and UTF-8, special care should be given not to cut in
half a Unicode character. For example, "show first 200 bytes" is not
good. That would create a feed that is not proper Unicode and a mess in
the resulting page.

Simos
Danilo Segan | 14 Oct 01:33 2004
Picon
Picon

Re: Trimming feed content

Yesterday at 20:35, Simos Xenitellis wrote:

> Regarding Unicode and UTF-8, special care should be given not to cut in
> half a Unicode character. For example, "show first 200 bytes" is not
> good. That would create a feed that is not proper Unicode and a mess in
> the resulting page.

With Python, that should be a non-issue (it's more difficult to get
raw byte string into Python, than correctly encoded UTF-8 as Unicode
string :).  Ok, Python holds it as UTF-16 (or was it UCS-2?), but it
still is not an issue (proper .encode(...) and .decode(...) must
already be there).

On the topic, Miguel, you might want to look at feedparser.py (so you
would cache trimmed version as well), or inside planet/__init__.py
(where all non-special fields are set, in NewsItem.update() I think).

Cheers,
Danilo
Rob Annable | 25 Oct 09:09 2004
Picon

help needed

Hi,

Apologies for posting this to the development mailing list but I was
wondering if someone could point me to a good forum or list for help
with planetplanet. I'm getting an error message to do with the
timestamp that I can't understand and could do with some advice.

Thanks,

Rob Annable
--

-- 
http://rob.annable.co.uk
Jeff Waugh | 25 Oct 09:12 2004

Re: help needed

<quote who="Rob Annable">

> Apologies for posting this to the development mailing list but I was
> wondering if someone could point me to a good forum or list for help with
> planetplanet. I'm getting an error message to do with the timestamp that I
> can't understand and could do with some advice.

Although the list is called 'devel', it's also a user help list, so here is
good. :-)

- Jeff

--

-- 
linux.conf.au 2005: Canberra, Australia         http://lca2005.linux.org.au/

   "The ability to procrastinate is what separates us from the machines."
                     - Chris Gregory, Desktop Magazine
Rob Annable | 25 Oct 09:39 2004
Picon

Re: help needed

On Mon, 25 Oct 2004 17:12:50 +1000, Jeff Waugh <jdub <at> perkypants.org> wrote:
> <quote who="Rob Annable">
> 
> > Apologies for posting this to the development mailing list but I was
> > wondering if someone could point me to a good forum or list for help with
> > planetplanet. I'm getting an error message to do with the timestamp that I
> > can't understand and could do with some advice.
> 
> Although the list is called 'devel', it's also a user help list, so here is
> good. :-)
> 
> - Jeff

Great, then here's my problem. My cron daemon spits this back at me
every time it runs, the output gets rendered but the html page doesn't
list the entries in the correct order. It seems to be trying to write
some timestamp info somewhere but failing. Here's the error message, I
currently have two rss feeds plugged into it.

INFO:root:Subscribing <http://rob.annable.co.uk/journal.cgi/index.rss10>
INFO:root:Updating feed <http://rob.annable.co.uk/journal.cgi/index.rss10>
DEBUG:root:Encoding: ISO-8859-1
DEBUG:root:URI: <http://rob.annable.co.uk/journal.cgi/index.rss10>
WARNING:root:Time cache write failed
<cache/rob.annable.co.uk.journal.cgi.index.rss10,times>
Traceback (most recent call last):
  File "/home/rytdsjzi/public_html/rob/planet/planetlib.py", line 439,
in _cached_time
    c = open(time_cache_uri, "a")
IOError: [Errno 2] No such file or directory:
(Continue reading)

Mary Gardiner | 25 Oct 10:23 2004

Re: help needed

On Mon, Oct 25, 2004, Rob Annable wrote:
> Great, then here's my problem. My cron daemon spits this back at me
> every time it runs, the output gets rendered but the html page doesn't
> list the entries in the correct order. It seems to be trying to write
> some timestamp info somewhere but failing. Here's the error message, I
> currently have two rss feeds plugged into it.

My guess is that you need the _directory_ it's trying to write to
("cache") to: already exist; and be writable by whatever user is running
the cron job.

-Mary
Rob Annable | 25 Oct 10:28 2004
Picon

Re: help needed

On Mon, 25 Oct 2004 10:23:59 +0200, Mary Gardiner
<mary-planet <at> puzzling.org> wrote:
> On Mon, Oct 25, 2004, Rob Annable wrote:
> > Great, then here's my problem. My cron daemon spits this back at me
> > every time it runs, the output gets rendered but the html page doesn't
> > list the entries in the correct order. It seems to be trying to write
> > some timestamp info somewhere but failing. Here's the error message, I
> > currently have two rss feeds plugged into it.
> 
> My guess is that you need the _directory_ it's trying to write to
> ("cache") to: already exist; and be writable by whatever user is running
> the cron job.
> 
> -Mary
> _______________________________________________

I thought that might be the case, but I couldn't figure out where it
wanted the directory to be. This line threw me:

<cache/rob.annable.co.uk.journal.cgi.index.rss10,times>

?

Rob

--

-- 
http://rob.annable.co.uk
Mary Gardiner | 25 Oct 10:52 2004

Re: help needed

On Mon, Oct 25, 2004, Rob Annable wrote:
> I thought that might be the case, but I couldn't figure out where it
> wanted the directory to be. This line threw me:
> 
> <cache/rob.annable.co.uk.journal.cgi.index.rss10,times>
> 
> ?

That's the path of the file it's trying to open (wrapped in <  and >).
Python's "open" command will fail if the directory doesn't exist.

It wants the "cache" directory to be under the directory with the
config.ini file, so something like this:

Your "something" directory contains:
 - config.ini
 - (probably) some template files
 - a cache directory

-Mary
Adam Crosby | 25 Oct 14:32 2004
Picon

Re: help needed

I had the same problem the first time I ran planet.py - you have to
create an empty directory called 'cache' in the directory with your
config.ini for the default setting to work.
If you'd rather it sit somewhere else, just change the variable
'cache_dir' in config.ini to point to the path you want the files to be
saved.

>>> Mary Gardiner <mary-planet <at> puzzling.org> 10/25/2004 4:52:49 AM >>>
On Mon, Oct 25, 2004, Rob Annable wrote:
> I thought that might be the case, but I couldn't figure out where it
> wanted the directory to be. This line threw me:
> 
> <cache/rob.annable.co.uk.journal.cgi.index.rss10,times>
> 
> ?

That's the path of the file it's trying to open (wrapped in <  and >).
Python's "open" command will fail if the directory doesn't exist.

It wants the "cache" directory to be under the directory with the
config.ini file, so something like this:

Your "something" directory contains:
 - config.ini
 - (probably) some template files
 - a cache directory

-Mary
_______________________________________________
Devel mailing list
(Continue reading)

Adam Crosby | 25 Oct 14:47 2004
Picon

Problem with fcntl.fcntl file locking on FreeBSD 4.x

Not sure if this is a bug or a problem with my python install, but here's what happened and how I fixed it:
(First some version info)

Python:
Python 2.3.2 (#1, Dec 10 2003, 13:29:44)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4

FreeBSD:
FreeBSD users.757.org 4.10-RELEASE-p2 FreeBSD 4.10-RELEASE-p2 #2: Wed Sep  1 00:26:09 EDT 2004

After getting everything all configured and working the way I wanted on my linux workstation, I moved my
install to my FreeBSD webhost.
I started getting this error everytime the script ran:

Traceback (most recent call last):
  File "planet.py", line 240, in ?
    template = TemplateManager().prepare(template_file)
  File "/home/count/planet/htmltmpl.py", line 204, in prepare
    precompiled = self.load_precompiled(file)
  File "/home/count/planet/htmltmpl.py", line 342, in load_precompiled
    self.lock_file(file, LOCK_UN)
  File "/home/count/planet/htmltmpl.py", line 275, in lock_file
    fcntl.fcntl(fd, fcntl.LOCK_UN)
IOError: [Errno 14] Bad address

After a bit of googling and testing, I changed the function 'lock_file' (line 263 in htmltmpl.py) to use
'fcntl.flock' instead of 'fcntl.fcntl':

    263     def lock_file(self, file, lock):
    264         """ do something """
(Continue reading)


Gmane