Re: template path problems



Tim Janik:
> well, the simplest reason is probably that we don't ahev access to httpd.conf,
> just yosh.

Then the symlinks will be handy there.

> >   http://beast.gtk.org/cgi-bin/logo-submissions/perpage/20

> eh? this starts to get really ugly ;)

Personally, I find that URL beautiful, but, you know, beauty is in the
of the beholder ;)

I prefer those path_info style URLs over

  http://beast.gtk.org/cgi-bin/logo-submissions?perpage=20

style.

> as an aside, it's inherently unsafe as people could point their
> browsers at http://beast.gtk.org/cgi-bin/logo-submissions/perpage/34
> or so similar things.

That's not an issue:

  - One line of code, ie. $perpage = 30 if $perpage > 30;
  - Since those are thumbnails, 34 of them won't get any bigger than
    a beast tarball.  Also, logical browsers and proxies will not try
    to open 34 connections at a time.

> > images from ../html/screenshots

> why would this take images from ../html/screenshots and the
> other from ../html/images/screenshots?
> i'm sorry, this is just too much magic for me ;)

Uh oh, nothing but pure typo magic ;)  I tried to mean
../html/images/screenshots.

> can we please go for a simple and explicit solution like:
> --- cgi-bin/screenshots.cgi ---
> IMAGE_ROOT=images/screenshots/
> HTML_TEMPLATE=screenshots.html
> exec gallery.cgi
> --- cgi-bin/screenshots.cgi ---

I can easily see a pattern in the above snippet.  Why not shorten it
to a single

  $0

and let the script evolve that to

  IMAGE_ROOT=images/$0/
  HTML_TEMPLATE=$0.html

and since the script is gallery.cgi, no need to explicitly exec
gallery.cgi ($0 is different than the script's real name, it's what
apache calls it, ie. via a symlink a la gzip vs. gunzip).

> >   cd /web/beast/cgi-bin/
> >   ln -s gallery screenshots
> >   ln -s gallery logo-submissions

> and where is the template?

../html/logo-submissions.html
../html/screenshots.html

> i don't see what "Ultimate configurability" is missing if
> you specify things explicitely. i'm just getting confused
> and don't know what magic naming/links etc. the scripts
> rely on (and if you explain i'll prolly have it forgotten
> in a month).

Of course you will forget.  I will forget too.  But then, we will
forget how we added current galleries also.  So we will look at the
cgi-bin directory, and notice this:

  $ ls -l cgi-bin
  -rwxrwxr-x  6 timj beast      10001 May  9 gallery
  -rwxrwxr-x  1 timj beast          7 May  9 logo-submissions -> gallery
  -rwxrwxr-x  1 timj beast          7 May  9 screenshots -> gallery

versus

  $ ls -l cgi-bin
  -rwxrwxr-x  6 timj beast      10001 May  9 gallery
  -rwxrwxr-x  1 timj beast        543 May  9 logo-submissions
  -rwxrwxr-x  1 timj beast        606 May  9 screenshots

Tell me which one is more obvious ;)

There is a whole lot more to forget about.  I always believed that's
the best part of writing a script, it means it's doing its job very
well ;)

If the CGI script will be a part of texitheque, I will document it.
I will also add a part about it in /web/beast/NOTES.

-- 
Alper Ersoy



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