[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Catching up with Boud

From: Dmitry Borodaenko
Subject: Catching up with Boud
Date: Sun, 8 Oct 2006 15:42:38 +0100

I've commited to CVS Boud's fixes for GetText < 1.6.0 and for
sites.yaml (no new Debian package yet), below are my comments to his

> It incorporates Boud's GetText fix (please review my version to see
> how I think it should be done)
Your version looks fine to me, but the question which i still have (i
forgot to ask it) is that it seems to me unnecessary and bad in terms
of operating speed to check the gettext version every time someone
starts a session.

That's why I moved this code to main body of engine.rb, when it will be
executed once per Ruby process, at the point where it is required for
the first time. On the other hand, "defined? GetText" is a trivial
operation that can stay where it is.

(1) rgettext-1.15 (2004/11/05) (debian-sarge) has a bug, and using it
requires a hack.

Yes, I reported this bug upstream, where it was eventually fixed. This
bug affects only development process of Samizdat and doesn't affect it's
deployment, so I don't think we should work around it, documenting it
and recommending newer version should be enough.

i tried looking for a more recent version of rgettext, but i found

Ruby-GetText-Package-1.8.0  2006-09-11 19:24

which by its version number is much older than rgettext 1.15, though
by its date is about but two years more recent, so i presume that
Ruby-GetText-Package and rgettext have different numbering schemes.

You're right. Check this:

Package: libgettext-ruby-util (0.8.0-1)

Also, Ruby-GetText-Package-1.8.0 says it requires ruby 1.8.3 or more
recent, whereas debian-sarge has 1.8.2, and IMHO we should be aiming
at samizdat requiring as few as possible packages more recent than
debian stable.

i'm preparing a new version of README.locale, but i'm interested what
people think of the  rgettext bug and whether or not we should report
it to the Ruby-GetText-Package people (someone would need to test it
with a more recent version than rgettext --version = 1.15).

Version from unstable (1.7.0) doesn't have this problem. As I said
above, this is not a dependency of Samizdat, not even a
build-dependency. Unless you want to update an existing translation for
newer strings, you don't even have to use rgettext, you can edit one of
existing .po files instead.

(2) rmsgmerge is not in my debian-sarge ruby distribution

Scripts like rmsgmerge and rgettext are in the libgettext-ruby-util

> And of course it should go into config.yaml instead.
Actually this is something i've been wondering about. Certainly having
it in config.yaml (or rather sites.yaml ?) would be better than
hardwired into index.rb ;).

But it also seems to me a reasonable idea that moderators, after
facilitating decisions on adding/removing feeds, should be able to
add/remove them without server admin intervention.

In other words, surely it should be a "resource" like any other
resource? i'm still rather fuzzy about the different resource
possibilities in samizdat, but i don't think it should be a "member"

It seems to me that open publishing of RDF feeds is probably
reasonable, if feeds on the front page require a decision implemented
by a moderator, and feeds on a registered member's page just require
that registered member to agree to it. So maybe it could be a message
of uri-list format?

Why uri-list, when there's "application/rss+xml" MIME type? Also,
uri-list is now gone from Samizdat code for good, I don't think we
should resurrect it.

Also, since RSS requires quite a lot of special treatment (like special
place on front page, special rules about refreshing it in regular
intervals), I'm not even sure it should be a Message, maybe special
resource class Feed should be introduced instead. Or even more general
Link class?

>> +  rss_pre= "<li><a href=\""
> I don't see why these 3 lines are necessary, when Ruby provides
> powerful string interpolation.
Ummm... i know that ruby has lots of powerful string "methods" - but
i'm not sure why these three lines are not useful.

They are not useful because you define three variables, each only to be
used once. Instead, you could use an interpolated string like:

%{<li><a %href="#{rss_link}">#{rss_title}</a></li><br />\n}

In addition to being more concise, this string gathers all relevant
layout in one place, and will be easier to extract to a template once we
start using ERb or other decent templating engine.

>> +            link.sub(/[ \n\t]*(http[^ \n\t]*)[ \n\t]*/,'\1')
> This regexp could also benefit from some explanation. Or from using \s
> for whitespace matching.
i thought i tried \s and it failed, but i can test it again...

Multi-line regexp flag missing?

i was thinking of, in the indymedia context, having at least 3
different classes of feeds:

* local (e.g. other alternative media sites in the local city/region)
* regional (e.g. indymedia sites in central/eastern europe) * global
(like on the right-hand column)

Aren't you unnecessarily multiplying entities here? We already have
focuses for organization of entities within Samizdat site, why
introducing another taxonomy system?

(2) examples/apache.conf:
i fail to be able to read any URL's of the form:


etc. with the present examples/apache.conf (this might have been
present earlier, i didn't fully update my apache conf recently) unless
i bring

    RewriteEngine on
    RewriteRule ^/([0-9]+)$ /resource.rb?id=$1 [PT]

outside of the /var/www/samizdat <directory> box.

Check the examples/apache.conf from latest CVS, it works for me with
Apache2 both for vhost and for directory based site. I think your
problem is the '/' that shouldn't be there in the RewriteRule:

RewriteRule ^([0-9]+)$ resource.rb?id=$1 [PT]

(3) examples/apache.conf:

IMHO it would be reasonable to suggest to the person installing a
directive so that s/he can easily install things like images, include
files in the /var/www/samizdat directory and have them correctly
picked up by apache.

i.e. add a few lines just before the close of the virtual host box

# Uncomment the following line if you want to add additional
# files such as a favicon.ico or include files to your samizdat
# setup:
#    AliasMatch ^/(.*) /var/www/samizdat/$1

I don't see the problem for this solution. DocumentRoot should take care
of this, so AliasMatch would only be necessary if you want to include
files from outside the document root.

* i couldn't see how to raise non-fatal exceptions which get reported
in the default  apache/error.log  - it seems to me that only *fatal*
errors get reported, but my guess is that this is just due to my
inexperience in ruby...

See log() helper method in engine/helpers.rb

*  i'm not sure whether there should be some sort of "reality check"
before untainting the URI which is given to the open call.

Depends on where the URI comes from. Throughout the code, I assume that
config files are to be trusted, and strings from the config can be
untainted freely. Anything else: data from the network, user messages
etc., should always be sanitized against a whitelist or a strict

To be continued (need more time to review new Boud's RSS import patch).

Dmitry Borodaenko

reply via email to

[Prev in Thread] Current Thread [Next in Thread]