lib/knj/rhodes/rhodes.rb in knjrbfw-0.0.23 vs lib/knj/rhodes/rhodes.rb in knjrbfw-0.0.24

- old
+ new

@@ -13,22 +13,18 @@ require "#{$knjpath}event_handler.rb" require "#{$knjpath}hash_methods.rb" require "#{$knjpath}errors.rb" require "#{$knjpath}gettext_threadded.rb" require "#{$knjpath}locales.rb" + require "#{$knjpath}locale_strings.rb" require "#{$knjpath}web.rb" if !Kernel.const_defined?("Mutex") print "Mutex not defined - loading alternative.\n" require "#{$knjpath}rhodes/mutex.rb" end - if !Kernel.const_defined?("WeakRef") - print "WeakRef not defined - loading alternative.\n" - require "#{$knjpath}rhodes/weakref.rb" - end - require "#{$knjpath}opts.rb" require "#{$knjpath}knjdb/libknjdb.rb" require "#{$knjpath}knjdb/revision.rb" require "#{$knjpath}knjdb/drivers/sqlite3/knjdb_sqlite3.rb" @@ -41,46 +37,50 @@ @callbacks_count = 0 @db = Knj::Db.new( :type => "sqlite3", :subtype => "rhodes", - :path => "#{Rho::RhoApplication.get_base_app_path}app/rhodes_default.sqlite3", + :path => "#{Rho::RhoApplication.get_user_path}rhodes_default.sqlite3", :return_keys => "symbols", :require => false ) if @args[:schema] schema = @args[:schema] else schema = {"tables" => {}} end + #Table used for options-module. schema["tables"]["Option"] = { "columns" => [ {"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true}, {"name" => "title", "type" => "varchar"}, {"name" => "value", "type" => "text"} ] } + #Run database-revision. dbrev = Knj::Db::Revision.new dbrev.init_db("schema" => schema, "db" => @db) + #Initialize options-module. + Knj::Opts.init( + "table" => "Option", + "knjdb" => @db + ) + + #Initialize objects-module. @ob = Knj::Objects.new( :db => @db, :class_path => "#{Rho::RhoApplication.get_base_app_path}app/models", :require => false, :module => @args[:module], - :datarow => true, - :cache => :none + :datarow => true ) - Knj::Opts.init( - "table" => "Option", - "knjdb" => @db - ) - + #Initialize locales. @gettext = Knj::Gettext_threadded.new @gettext.load_dir("#{Rho::RhoApplication.get_base_app_path}app/locales") locale = "#{System.get_property("locale")}_#{System.get_property("country")}".downcase @@ -179,11 +179,11 @@ return block end end #This method is used to emulate web-behavior and make Knj::Locales.number_out and friends work properly. -def _session(key) - return $rhodes.session_key(key) +def _session + return {:locale => $rhodes.locale} end #This method is used to make gettext work. def _(key) return $rhodes._(key) \ No newline at end of file