view · edit · sidebar · attach · print · history

Index>

20160427-ydim-html-ruby-2-3

Summary

  • Port ydim-html to Ruby 2.3

Commits

Index

Keep in Mind for work to do
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Import via data/medreg_companies.yaml
  • Fix problem with radioactivatum 99m-technetio when parsing Wirkstoffe
  • Fix galenic_forms when parsing swissmedic.xlsx
  • Cleanup generic_type. Replace it everywhere by sl_generic_type and adapt code accordingly.
  • Get updated ATC-codes from EPha for oddb.org, too.
  • Use refdatabase for oddb.org, too.
  • Check whether we should revert the part which touche src/plugin/text_info.rb of commit 17af82ba4d76a5838683411b260de265531f9e74. We should improve test/stub/oddbapp.rb to work similar for update/pointer as the real oddbapp. In this case we would have a good Stub for plugins. May we need a different stub when working with plugins (which create/modify/destroy ODDB-Objects), when in most other cases a very simple stub is sufficient.
  • When a logged in admin user changes an atc_code of a product, the corresponding atc_class must update its sequences, too.
  • Order of entering search type and value should not matter. Both should show long URL with search
  • Remove parser for minifi (but keep the minifi)
  • BSV-Plugin does not send mail. Is it sending two mails at once?
  • remove obsolete pdf_patinfo in model, admin/views

Port ydim-html to Ruby 2.3

I do not get farther than the login dialog. But via https://ydim.oddb-ci2.dyndns.org/de I don't get a list of the customer. Why? For the moment just patched lib/ydim/html/state/init.rb to return always true on login.

In the ydim-html (ruby 2.3.0) process I added the following debug statements for the _to_html method in lib/htmlgrid/component.rb

if @value.is_a?(String) && /ller/i.match(@value)
        $stderr.puts "to_html1 #{@value.inspect} > 1.9? #{RUBY_VERSION > "1.9"}"
        $stderr.puts "to_html2 #{@value.encoding}" if @value && @value.respond_to?(:encoding)
        $stderr.puts "to_html3 #{ _to_html(context, @value).to_s.force_encoding('utf-8').inspect}"
end

and got

to_html1 "Müller" > 1.9? true
to_html2 UTF-8
to_html3 "Müller"

but the HTML output is still

It looks to me that mod_ruby for 1.9.1 has problems accepting the UTF-8 encoded output returned from ydim-html (Ruby 2.3.0).

Trying again to make test spec tests with watir run. Finally the watir test starts up and I am able to run my fist test, and check that I can login.

See

I am having Umlaut problems, too. Looking into the source of the HTML document I see next_invoice_date">Nächste Rechnung</A> and ACCEPT-CHARSET="UTF-8" ENCTYPE="application/x-www-form-urlencoded">. Whereas I YDIM::Html::Custom::Lookandfeel::DICTIONARIES['de'] [:th_next_invoice_date] returns (via pry) "Nächste Rechnung" and its encoding is Encoding:UTF-8.

Found the way to debug errors by setting @http_server.logger.level = WEBrick::BasicLog::DEBUG for the YDIM::Html::Stub.http_server(drb_url). Now I can debug, why the login spec test did run only once.

Removed manually the htmlgrid/ext/htmlgrid/*o files or I would get an error when running with Ruby 2.3.0. Now I see always a warning could not find htmlgrid.so, falling back to pure-ruby class, which is fine for the moment for me.

Pushed commit First watir spec test passes, as I am unable to finish creating a spec test for creating successfully an invoice.

Running locally with the following to lines in Gemfile to be able to easily debug sbsm/htmlgrid, too.

gem "sbsm",    :path => '/home/niklaus/git/sbsm'
gem "htmlgrid", :path => '/home/niklaus/git/htmlgrid'

When I try to run two tests I get errors like

[2016-04-27 17:35:26] DEBUG WEBrick::HTTPServlet::ProcHandler is invoked.

From: /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/cgi/core.rb @ line 663 CGI::QueryExtension#initialize_query:

    658:                         env_table['QUERY_STRING'] or ""
    659:                       end
    660:                     when "POST"
    661:                       stdinput.binmode if defined? stdinput.binmode
    662:                       binding.pry unless env_table['CONTENT_LENGTH']
 => 663:                       stdinput.read(Integer(env_table['CONTENT_LENGTH'])) or ''
    664:                     else
    665:                       read_from_cmdline
    666:                     end.dup.force_encoding(@accept_charset)
    667:                   )
    668:         unless Encoding.find(@accept_charset) == Encoding::ASCII_8BIT

[1] pry(#<CGI>)> continue
[2016-04-27 17:35:32] ERROR TypeError: can't convert nil into Integer
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/cgi/core.rb:663:in `Integer'
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/cgi/core.rb:663:in `initialize_query'
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/cgi/core.rb:853:in `initialize'
        /opt/src/sbsm/lib/sbsm/request.rb:41:in `new'
        /opt/src/sbsm/lib/sbsm/request.rb:41:in `initialize'
        /opt/src/ydim-html/spec/stub/http_server.rb:59:in `new'
        /opt/src/ydim-html/spec/stub/http_server.rb:59:in `block in http_server'
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/httpservlet/prochandler.rb:39:in `do_GET'
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/httpservlet/abstract.rb:107:in `service'
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
        /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Which is displayed as "Internal Server Error: can't convert nil into Integer".

TODO for next week:

  • Why can't we login twice?
  • Why is "Nächste Rechnung" not displayed correctly

It looks like we are missing in ydim-html code the line ACCEPT_CHARSET = 'UTF-8' found in src/view/form.rb

view · edit · sidebar · attach · print · history
Page last modified on April 27, 2016, at 06:22 PM