lib/openwfe/participants/participantmap.rb in openwferu-0.9.7 vs lib/openwfe/participants/participantmap.rb in openwferu-0.9.8
- old
+ new
@@ -101,12 +101,21 @@
participant = participant.new
end
end
- regex = Regexp.new(regex.to_s) unless regex.kind_of? Regexp
+ unless regex.kind_of? Regexp
+ regex = regex.to_s
+ regex = "^" + regex unless regex[0, 1] == "^"
+ regex = regex + "$" unless regex[-1, 1] == "$"
+
+ ldebug { "register_participant() '#{regex}'" }
+
+ regex = Regexp.new(regex)
+ end
+
participant.application_context = @application_context \
if participant.respond_to? :application_context=
@participants << [ regex, participant ]
@@ -116,9 +125,11 @@
#
# Looks up a participant given a participant_name.
# Will return the first participant whose name matches.
#
def lookup_participant (participant_name)
+
+ #ldebug { "lookup_participant() '#{participant_name}'" }
@participants.each do |tuple|
return tuple[1] if tuple[0].match(participant_name)
end
return nil