sbsm 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b8934dcd4cdbd63fead780bf5bf87af408d43d3
4
- data.tar.gz: 9bddb67fbce3b770fa182691a3af7a57b74afbdf
3
+ metadata.gz: 628fb2c05a02cc101b12decbfd9adb36841c6708
4
+ data.tar.gz: 2ac44dd32371d5ba87c6ff48f5e33f0348a84f96
5
5
  SHA512:
6
- metadata.gz: 70d380793a5eead1e398f0ea38a9294fc34e7a661c03004bdcb5a4dd679dedefdd32e342f5c6a2ad0f4fe6e93e7591f022d2d413b72f1db0af78b868794c0e1d
7
- data.tar.gz: 39ee8b6ccb16477c0726a20ae817abff227540e47ac1b87366702c8d4bf5aff5bc7e2cb787ed76c82d3174fcdb1629803361bd9f3356d6082e4eb650724f070e
6
+ metadata.gz: 2a8511976a0371bd485a08ef740fe1c7983cf55c4fb65edfa9a8afee7d69ae2ff88adac5d20450949202a10fac9795ea3ffda58caef2e552ab266c4daf94ac14
7
+ data.tar.gz: 830b11c719faa20a247697d72b571ff7ad8273bbb26ac4176d13a639ce604715b9371fddfe39e3e8a895d57d782f3af4f1085b03f40d22aa6fd5636f6729540d
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.4.3 / 06.06.2017
2
+
3
+ * Allow access to request_origin and request_params for POST processing in xmlconf
4
+ * Fix unit tests
5
+
1
6
  === 1.4.2 / 23.05.2017
2
7
 
3
8
  * Allow overriding http_protocol via ENV variable SERVER_PORT
data/lib/sbsm/session.rb CHANGED
@@ -37,7 +37,8 @@ module SBSM
37
37
  class Session
38
38
 
39
39
  attr_reader :user, :active_thread, :key, :cookie_input, :cookie_name,
40
- :unsafe_input, :valid_input, :request_path, :cgi, :attended_states
40
+ :server_name, :server_port, :request_params, :request_method, :request_origin,
41
+ :unsafe_input, :valid_input, :request_path, :request_post, :cgi, :attended_states
41
42
  attr_accessor :validator, :trans_handler, :app
42
43
  PERSISTENT_COOKIE_NAME = "sbsm-persistent-cookie"
43
44
  DEFAULT_FLAVOR = 'sbsm'
@@ -209,8 +210,17 @@ module SBSM
209
210
  begin
210
211
  @request_method =rack_request.request_method
211
212
  @request_path = rack_request.path
213
+ if rack_request.env
214
+ @request_origin = 'http'
215
+ if (proto = rack_request.env['SERVER_PROTOCOL'])
216
+ @request_origin = proto.downcase.match(/^\w+/)[0]
217
+ end
218
+ @request_origin += '://'
219
+ @request_origin += rack_request.env['REMOTE_ADDR'] if rack_request.env['REMOTE_ADDR']
220
+ end
212
221
  @server_name = rack_request.env['SERVER_NAME']
213
222
  @server_port = rack_request.env['SERVER_PORT']
223
+ @request_params = rack_request.params
214
224
  logout unless @active_state
215
225
  validator.reset_errors() if validator && validator.respond_to?(:reset_errors)
216
226
  import_user_input(rack_request)
data/lib/sbsm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SBSM
2
- VERSION = '1.4.2'
2
+ VERSION = '1.4.3'
3
3
  end
@@ -177,8 +177,8 @@ class TestLookandfeel < Minitest::Test
177
177
  end
178
178
  def test_format_price
179
179
  assert_equal('123.45', @lookandfeel.format_price(12345))
180
- assert_equal(nil, @lookandfeel.format_price(nil))
181
- assert_equal(nil, @lookandfeel.format_price(0))
180
+ assert_nil(@lookandfeel.format_price(nil))
181
+ assert_nil(@lookandfeel.format_price(0))
182
182
  end
183
183
  def test_format_date
184
184
  hannesgeburtstag = Date.new(1975,8,21)
@@ -21,7 +21,7 @@
21
21
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zürich, Switzerland
22
22
  # hwyss@ywesee.com
23
23
  #
24
- # TestValidator -- sbsm -- 15.11.2002 -- hwyss@ywesee.com
24
+ # TestValidator -- sbsm -- 15.11.2002 -- hwyss@ywesee.com
25
25
 
26
26
  $: << File.dirname(__FILE__)
27
27
  $: << File.expand_path("../lib", File.dirname(__FILE__))
@@ -59,7 +59,7 @@ class TestValidator < Minitest::Test
59
59
  assert_equal({}, @val.errors)
60
60
  end
61
61
  def test_validate
62
- assert_equal(nil, @val.validate(:something, :other) )
62
+ assert_nil(@val.validate(:something, :other) )
63
63
  end
64
64
  def test_boolean
65
65
  assert_equal(true, @val.validate(:bool, 'true'))
@@ -106,19 +106,19 @@ class TestValidator < Minitest::Test
106
106
  def test_date
107
107
  assert_equal(Date.new(2002,1,2), @val.validate(:date, '2.1.2002'))
108
108
  assert_equal(SBSM::InvalidDataError, @val.validate(:date, '13.13.1234').class)
109
- assert_equal(nil, @val.validate(:date, " \t"))
109
+ assert_nil(@val.validate(:date, " \t"))
110
110
  end
111
111
  def test_state_id
112
- assert_equal(nil, @val.validate(:state_id, nil))
113
- assert_equal(nil, @val.validate(:state_id, "df"))
112
+ assert_nil(@val.validate(:state_id, nil))
113
+ assert_nil(@val.validate(:state_id, "df"))
114
114
  assert_equal(1245, @val.validate(:state_id, "1245"))
115
115
  assert_equal(-1245, @val.validate(:state_id, "-1245"))
116
116
  end
117
117
  def test_pattern
118
118
  assert_equal('new', @val.validate(:pattern, 'new'))
119
119
  assert_equal('12345', @val.validate(:pattern, '12345'))
120
- assert_equal(nil, @val.validate(:pattern, '23foo45'))
121
- assert_equal(nil, @val.validate(:pattern, 'abfoodc'))
120
+ assert_nil(@val.validate(:pattern, '23foo45'))
121
+ assert_nil(@val.validate(:pattern, 'abfoodc'))
122
122
  end
123
123
  def test_validate_html
124
124
  src = "<SPAN style=\"PADDING-BOTTOM: 4px; LINE-HEIGHT: 1.4em; WHITE-SPACE: normal\"><p class=\"MsoNormal\" style=\"MARGIN: 0cm -0.3pt 0pt 0cm; TEXT-ALIGN: justify\"><span lang=\"DE\" style=\"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'\">Wirkstoff: Ibuprofenum. </span></p><p class=\"MsoNormal\" style=\"MARGIN: 0cm -0.3pt 0pt 0cm; TEXT-ALIGN: justify\"><span lang=\"DE\" style=\"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'\">Hilfsstoffe: Conserv.: Sorbinsäure (E 200)</span></p></span>"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-23 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack