[Nitro] George: annotation :text_key
Jonathan Buch
john at oxyliquit.de
Mon Jun 4 16:23:49 EDT 2007
Hi George,
sorry for destroying your text keys last time. :P
def load(pk)
if (key = ann(:self, :text_key)) && pk.to_i == 0 && (pk !~ /\S{22}/)
I think however that there might be potential problems which could
confuse unknowing users.
* any pk with more than 22 consecutive non witespace chars + text key
(that regex should really be /\A\S{22}$\z/ if at all)
* Tag['1.41']
meaning the to_i is potentionally shadowing some values and will raise
a not meaningful DB error (string not applicapable for integer column)
and at seemingly 'random' values.
* OgKlass[request['oid']]
meaning a string could be passed from someone who doesn't know, which
all satisfies that, but still is wrong because the primary key of
OgKlass is a text key itself, maybe containing "0 Cool".
This is the three ways I think this method could go wrong (besides it
using 'unnecessary' annotations).
But then, this is only theoretically, as this is is a toally undocumented
feature which only can be found by RTFS'ing and is solely used in
Taggable (and even there undocumented).
So I guess this has its point, as it's only used by a single person
who knows what he's doing. ;)
Jo
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Nitro-general
mailing list