On Feb 06, "H. Turgut Uyar" <u...@itu.edu.tr> wrote:

> I get the impression that there is be a better way to achieve
> what I was aiming at and it could also be used for links to
> movies/persons/characters in plots or similar fields.

Maybe - I fear I don't really get all the implications for imdbpykit.

To summarize: there's a lot of code that - behind the scenes - can
handle links to movies/persons/characters references inside a normal
text field like 'plot' or 'biography' (when they were specified
as links in the original web page/text file).  This means that these
text fields be easily changed, replacing these placeholders (if any)
with a string that includes the movieID/personID/characterID.

As said, the function in the helpers module can help building a
function that, if passed to imdb.IMDb, will make the whole process
wholly transparent.

I.e., using a custom function:
  import imdb
  import imdb.helpers
  myFunct = helpers.makeModCGILinks(personTxt='<a 
href="/name/%(personID)s">%(name)s</a>')

  ia = imdb.IMDb(...., defaultModFunct=myFunct)

  movie = ia.get_movie(...)

  print movie['plot']

Can output something like:
  " ... <a href="/name/0000154">Mel Gibson</a> plays ..."


> In that case, I should vote for reverting the patch

> and doing it right even if it might take time to implement.

I think that, for the strings where placeholders were replaced,
we'll need to build a child out of this string (so that the tags
inside will be considered as XML elements).
Nothing prevents the defaultModFunct function to do this
transparently (it can be a wrapper that takes the output of
the function built with helpers.makeModCGILinks, and returns
a node element).

> > - by default, if no defaultModFunct is passed to imdb.IMDb, the
> >   string is returned with the "special marking" removed.
> 
> So that's what modFunct is! It's always been a mystery to me when
> I saw it in the code :-)

My taste for meaningless names for functions doesn't help. :-)


-- 
Davide Alberani <davide.alber...@gmail.com> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to