Update IkiWiki::openiduser to work with Net::OpenID 2.x
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sun, 21 Jun 2009 11:12:30 +0000 (12:12 +0100)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 7 Jul 2009 17:38:04 +0000 (13:38 -0400)
openiduser previously used a constructor that no longer works in 2.x.
However, all we actually want is the (undocumented) DisplayOfURL function
that is invoked by the display method, so try to use that.
(cherry picked from commit c3dd0ff5c7c10743107f203a5b456fdcd1b171df)

IkiWiki/Plugin/openid.pm
debian/changelog

index 5424c57e2c6f8e8093eb56d1aba6aee696a05b39..87569915bec309e8e3e8243299f1f0db05828208 100644 (file)
@@ -189,8 +189,18 @@ sub openiduser ($) {
 
        if ($user =~ m!^https?://! &&
            eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
-               my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user);
-               my $display=$oid->display;
+               my $display;
+
+               if (Net::OpenID::VerifiedIdentity->can("DisplayOfURL")) {
+                       # this works in at least 2.x
+                       $display = Net::OpenID::VerifiedIdentity::DisplayOfURL($user);
+               }
+               else {
+                       # this only works in 1.x
+                       my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user);
+                       $display=$oid->display;
+               }
+
                # Convert "user.somehost.com" to "user [somehost.com]"
                # (also "user.somehost.co.uk")
                if ($display !~ /\[/) {
index c119dea8e954a831269b8bde91ec148c76a53503..bb33f25f3edd468e7276835888199d73894aca71 100644 (file)
@@ -2,6 +2,8 @@ ikiwiki (3.1415) UNRELEASED; urgency=low
 
   * img: Fix extra double quote with alt text. (smcv)
   * Updated French debconf templates translation. Closes: #535103
+  * openid: Support Net::OpenID 2.x when pretty-printing
+    openids. (smcv)
 
  -- Joey Hess <joeyh@debian.org>  Tue, 16 Jun 2009 15:08:31 -0400