[MOBY-guts] biomoby commit
Eddie Kawas
kawas at dev.open-bio.org
Fri Aug 28 14:15:58 UTC 2009
kawas
Fri Aug 28 10:15:57 EDT 2009
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi
In directory dev.open-bio.org:/tmp/cvs-serv17648/MOBY-Server/share/cgi
Modified Files:
RESOURCES
Log Message:
bug fix: sometimes users hit the url with Objects/, or Namespaces/, etc and the trailing slash tripped up the script.
moby-live/Perl/MOBY-Server/share/cgi RESOURCES,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/RESOURCES,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/RESOURCES 2008/06/19 17:02:25 1.3
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/RESOURCES 2009/08/28 14:15:57 1.4
@@ -47,7 +47,8 @@
$url =~ s/%([\da-f][\da-f])/chr( hex($1) )/egi;
my $form = new CGI;
-if ( $url =~ m/^RESOURCES\/MOBY\-S\/Objects(\/[A-Za-z0-9_\-]*)?$/ ) {
+if ( $url =~ m/^RESOURCES\/MOBY\-S\/Objects(\/[A-Za-z0-9_\-]+)?$/ ) {
+ my $byName = length( substr $1, 1) > 0 if $1;
do {
if ($useCache) {
my $x =
@@ -60,14 +61,15 @@
$x = $x->createAll();
print $form->header('text/xml'), $x if $x;
}
- } unless $1;
+ } unless $byName;
do {
my $x = MOBY::RDF::Ontologies::Objects->new;
my $rdf = $x->createByName( { term => substr $1, 1 } );
print $form->header('text/xml'), $rdf if $rdf;
- } if $1;
+ } if $byName;
-} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Services(\/[A-Za-z0-9_\-]*)?$/ ) {
+} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Services(\/[A-Za-z0-9_\-]+)?$/ ) {
+ my $byName = length( substr $1, 1) > 0 if $1;
do {
if ($useCache) {
my $x =
@@ -80,12 +82,12 @@
$x = $x->createAll();
print $form->header('text/xml'), $x if $x;
}
- } unless $1;
+ } unless $byName;
do {
my $x = MOBY::RDF::Ontologies::ServiceTypes->new;
my $rdf = $x->createByName( { term => substr $1, 1 } );
print $form->header('text/xml'), $rdf if $rdf;
- } if $1;
+ } if $byName;
} elsif ( $url =~
m/^RESOURCES\/MOBY\-S\/ServiceInstances(\/[A-Za-z0-9_\-.]*,[A-Za-z0-9_\-]*){1}$/
)
@@ -117,7 +119,7 @@
} unless $string;
} elsif ( $url =~
-m/^RESOURCES\/MOBY\-S\/ServiceInstances(\/[A-Za-z0-9_\-.]*\/[A-Za-z0-9_\-]*)?$/
+m/^RESOURCES\/MOBY\-S\/ServiceInstances(\/[A-Za-z0-9_\-.]+\/[A-Za-z0-9_\-]+)?$/
)
{
my $string = $1 || "";
@@ -169,25 +171,28 @@
print $form->header('text/xml'), $x if $x;
} if $string;
-} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Namespaces(\/[A-Za-z0-9_\-]*)?$/ ) {
- do {
- if ($useCache) {
- my $x =
- MOBY::RDF::Ontologies::Cache::NamespaceCache->new(
- cache => "$dir", );
- $x = $x->get_rdf();
- print $form->header('text/xml'), $x if $x;
- } else {
- my $x = MOBY::RDF::Ontologies::Namespaces->new;
- $x = $x->createAll();
- print $form->header('text/xml'), $x if $x;
- }
- } unless $1;
+} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Namespaces(\/[A-Za-z0-9_\-]+)?$/ ) {
+ my $byName = length( substr $1, 1) > 0 if $1;
do {
my $x = MOBY::RDF::Ontologies::Namespaces->new;
my $rdf = $x->createByName( { term => substr $1, 1 } );
print $form->header('text/xml'), $rdf if $rdf;
- } if $1;
+ } if $byName;
+
+ do {
+ if ($useCache) {
+ my $x =
+ MOBY::RDF::Ontologies::Cache::NamespaceCache->new(
+ cache => "$dir", );
+ $x = $x->get_rdf();
+ print $form->header('text/xml'), $x if $x;
+ } else {
+ my $x = MOBY::RDF::Ontologies::Namespaces->new;
+ $x = $x->createAll();
+ print $form->header('text/xml'), $x if $x;
+ }
+ } unless $byName;
+
} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/FULL$/ ) {
my $dom = undef;
my $parser = XML::LibXML->new();
More information about the MOBY-guts
mailing list