[pve-devel] r5039 - pve-common/trunk
svn-commits at proxmox.com
svn-commits at proxmox.com
Fri Aug 20 12:19:25 CEST 2010
Author: dietmar
Date: 2010-08-20 10:19:25 +0000 (Fri, 20 Aug 2010)
New Revision: 5039
Modified:
pve-common/trunk/ChangeLog
pve-common/trunk/RESTHandler.pm
Log:
* RESTHandler.pm (register_method): allow us to use regex in the
path template, for example path => '{method:(lvm|iscsi|nfs)}'
Modified: pve-common/trunk/ChangeLog
===================================================================
--- pve-common/trunk/ChangeLog 2010-08-20 09:48:42 UTC (rev 5038)
+++ pve-common/trunk/ChangeLog 2010-08-20 10:19:25 UTC (rev 5039)
@@ -1,5 +1,8 @@
2010-08-20 Proxmox Support Team <support at proxmox.com>
+ * RESTHandler.pm (register_method): allow us to use regex in the
+ path template, for example path => '{method:(lvm|iscsi|nfs)}'
+
* JSONSchema.pm (validate): new 'fragmentDelimiter' option.
* RESTHandler.pm (find_handler): remove 'require' - we load
Modified: pve-common/trunk/RESTHandler.pm
===================================================================
--- pve-common/trunk/RESTHandler.pm 2010-08-20 09:48:42 UTC (rev 5038)
+++ pve-common/trunk/RESTHandler.pm 2010-08-20 10:19:25 UTC (rev 5039)
@@ -26,9 +26,9 @@
foreach my $comp (split(/\/+/, $info->{path})) {
die "path compoment has zero length" if $comp eq '';
- if ($comp =~ m/^\{(\w+)\}$/) {
+ if ($comp =~ m/^\{(\w+)(:(.*))?\}$/) {
my $name = $1;
- push @$match_re, '\S+';
+ push @$match_re, $3 ? $3 : '\S+';
push @$match_name, $1;
} else {
push @$match_re, $comp;
More information about the pve-devel
mailing list