[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4975] trunk
- Subject: SF.net SVN: ledger-smb:[4975] trunk
- From: ..hidden..
- Date: Fri, 13 Jul 2012 07:33:12 +0000
Revision: 4975
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4975&view=rev
Author: einhverfr
Date: 2012-07-13 07:33:12 +0000 (Fri, 13 Jul 2012)
Log Message:
-----------
Correcting some issues with web service framework
Modified Paths:
--------------
trunk/lsmb-request.pl
trunk/rest-handler.pl
Property Changed:
----------------
trunk/rest-handler.pl
Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl 2012-07-13 07:09:40 UTC (rev 4974)
+++ trunk/lsmb-request.pl 2012-07-13 07:33:12 UTC (rev 4975)
@@ -64,16 +64,13 @@
if ($request->{_user}){
$LedgerSMB::App_State::User = $request->{_user};
- warn $request->{_user}->{language};
$locale = LedgerSMB::Locale->get_handle($request->{_user}->{language});
- warn $locale;
$LedgerSMB::App_State::Locale = $locale;
} else {
- #$locale = LedgerSMB::Locale->get_handle('en');
$locale = LedgerSMB::Locale->get_handle( $LedgerSMB::Sysconfig::language );
- #$request->error( __FILE__ . ':' . __LINE__ .
- # ": Locale ($LedgerSMB::Sysconfig::language) not loaded: $!\n"
- #) unless $locale;
+ $request->error( __FILE__ . ':' . __LINE__ .
+ ": Locale ($LedgerSMB::Sysconfig::language) not loaded: $!\n"
+ ) unless $locale;
$LedgerSMB::App_State::Locale = $locale;
}
Modified: trunk/rest-handler.pl
===================================================================
--- trunk/rest-handler.pl 2012-07-13 07:09:40 UTC (rev 4974)
+++ trunk/rest-handler.pl 2012-07-13 07:33:12 UTC (rev 4975)
@@ -1,3 +1,5 @@
+#!/usr/bin/perl
+
=head1 NAME
LedgerSMB::Handlers::REST_Handler - REST handler for new code sections
@@ -143,9 +145,9 @@
use Try::Tiny;
use strict;
use warnings;
+warn 'starting';
+process_request();
-return process_request();
-
# Note: Indenting try/catch only two characters here because it wraps all
# substantive logic in the function. -CT
sub process_request{
@@ -225,11 +227,12 @@
my ($error) = @_;
my $content = $error;
$content =~ s/^\d\d\d\s//;
- $error =~ s/(.*$).*/$1/m;
- if ($error =~ /^\d\d\d\s/){
+ $error =~ s/(.*)\n.*/$1/m;
+ if ($error =~ /^\d\d\d/){
$error = "500 $error";
}
- output({state => $error, content => $content});
+ warn $error;
+ output({state => $error, content => $content, content_type => 'text/text'});
}
# Isolating request-> hashref logic so that it is easier to port to other
@@ -274,10 +277,10 @@
$request->{classes} = {};
$request->{class_name} = 'LedgerSMB::REST_Class';
- while (@$components) {
- my $class = shift @$components;
- my $id = shift @$components;
- $id = undef if $id = 'all';
+ while (@components) {
+ my $class = shift @components;
+ my $id = shift @components;
+ $id = undef if $id == 'all';
$request->{class_name} .= "::$class";
$request->{classes}->{$request->{class_name}} = $id;
}
@@ -287,7 +290,7 @@
# Isolating output routine
sub output {
- my ($args) = $_;
+ my ($args) = @_;
my $ctype;
my $cgi = CGI::Simple->new();
Property changes on: trunk/rest-handler.pl
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.