Tags:
create new tag
view all tags

Question

Hi, I'm trying to make my build-bot upload a twiki-formatted log of the build-process via WWW::Mechanize, however I cannot get the bot to authenticate correctly, it just always returns the Oops-register page. I'll upload the WWW::Mechanize script also...

I have uploaded the script which tries to upload here, the interesting lines are:


#
# at this point the following variables are set and contains the
# following data:

my $arg_twiki_username = "MikaelOlenfalk";
my $arg_twiki_password = "mypassword"; # << correct, have triple-checked
my $build_date_and_time = "2005-10-29 12:30:45";
my $arg_twiki_server = "stewie";
my $arg_twiki_web = "EyeTracking";
my $arg_twiki_project_title = "EyeTrackingCore";
my $build_project_failed = 0;

my $twiki_output = "THE COMPLETE TOPIC";

#
# upload topic
#

{
  package MyMech;
  our @ISA = qw(WWW::Mechanize);

  sub get_basic_credentials
    {
      return ($arg_twiki_username, $arg_twiki_password);
    }
}

my $agent = MyMech->new();

my $great_date = $build_date_and_time;
$great_date =~ s/[^0-9]//g;
my $twiki_url = "http://${arg_twiki_server}/cgi-bin/twiki/edit/${arg_twiki_web}/BuildLog${arg_twiki_project_title}${great_date}?templatetopic=BuildLogTemplate&topicparent=BuildLogs&Date=${build_date_and_time}&Project=${arg_twiki_project_title}&";
if ($build_project_failed > 0) {
  $twiki_url .= "State=Failure (Need Investigation)";
} else {
  $twiki_url .= "State=Success";
}

# get the empty page

$agent->get ($twiki_url)
  or die "E: Could not get $twiki_url\n"; # <<<< this returns OOPS-REGISTER

$agent->form_name ("main")
  or die "E: No formed named main\n";
$agent->field ("text", $twiki_output);
my $response = $agent->click_button (name => "action", value => "Save");

die "E: AAAAAAAAAAARRRGGGHHH" unless $response->is_success;

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Sarge
Web server: Apache 2.0.54
Perl version: 5.8.7
Client OS:  
Web Browser:  
Categories: Authorisation, Missing functionality

-- MikaelOlenfalk - 31 Oct 2005

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Did you see CPAN:WWW:Mechanize::TWiki?

-- MartinCleaver - 31 Oct 2005

i.e. http://search.cpan.org/author/WBNIV/WWW-Mechanize-TWiki-0.10/lib/WWW/Mechanize/TWiki.pm

-- MartinCleaver - 31 Oct 2005

Also see WikiGateway

-- MartinCleaver - 31 Oct 2005

Sorry for my late answer I was unable to dedicate any time for the project which needs the upload capability. I had a look at booth CPAN:WWW::Mechanize::TWiki and WikiGateway but as it seems, CPAN:WWW::Mechanize::TWiki doesn't work on Windows under ActivePerl and WikiGateway doesn't seem to have a TWiki backend yet...

-- MikaelOlenfalk - 09 Nov 2005

CPAN:WWW::Mechanize doesn't work on windows? i wonder why not? can you provide more information (i don't have a windows box to test it on), but it should work as it's a pure perl subclass of CPAN:WWW::Mechanize (or does CPAN:WWW::Mechanize not work on windows?)

-- WillNorris - 09 Nov 2005

I use a simpler technique

wget http://twiki/bin/save/Someweb/ItemXXXXXXXXXX?text=whatever
will create a new topic with a unique topc name (in Dakar, for Cairo there is a patch) with a topic text of 'whatever' smile

-- SvenDowideit - 09 Nov 2005

WillNorris: CPAN:WWW::Mechanize does indeed work, its just that CPAN:WWW::Mechanize::TWiki isnt available for ActivePerl because of some build problem and just copying WWW::Mechanize::TWiki from a linux box doesn't work.

-- MikaelOlenfalk - 21 Nov 2005

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2005-11-21 - MikaelOlenfalk
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.