xo::PackageMgr instproc require (public)

 <instance of xo::PackageMgr[i]> require [ -url url ] package_id

Defined in packages/xotcl-core/tcl/06-package-procs.tcl

Create package object if needed.

Switches:
-url
(optional)
Parameters:
package_id

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_folder_with_page create_folder_with_page (test xowf) xo::PackageMgr instproc require xo::PackageMgr instproc require test_create_folder_with_page->xo::PackageMgr instproc require test_create_form_with_form_instance create_form_with_form_instance (test xowiki) test_create_form_with_form_instance->xo::PackageMgr instproc require test_xowiki_test_cases xowiki_test_cases (test xowiki) test_xowiki_test_cases->xo::PackageMgr instproc require apm_package_key_from_id apm_package_key_from_id (public) xo::PackageMgr instproc require->apm_package_key_from_id

Testcases:
create_folder_with_page, xowiki_test_cases, create_form_with_form_instance
Source code:
if {$package_id eq ""} {
  #::xo::show_stack
  error "package_id must not be empty"
}

#:log "--R $package_id exists? [nsf::is object ::$package_id] url='$url'"

if {![nsf::is object ::$package_id]} {
  #:log "--R we have to create ::$package_id //url='$url'"
  #
  # To make initialization code generic, we obtain from the
  # package_id the class of the package.
  #
  set package_key [apm_package_key_from_id $package_id]
  set package_class [[self class] get_package_class_from_package_key $package_key]
  if {$package_class eq ""} {
    #
    # For some unknown reason, we did not find the key.  We want
    # to be conservative, behave like in older versions that did
    # not provide a package_key, but required for this call to be
    # invoked on the actual class of the package. We provide
    # compatibility, but complain in ns_log.
    #
    # (E.g. hypermail2xowiki uses this)
    ns_log warning "Could not find ::xo::Package with key $package_key ($package_id)"
    set package_class [self]
  }

  if {$url ne ""} {
    $package_class create ::$package_id -destroy_on_cleanup -id $package_id -url $url
  } else {
    $package_class create ::$package_id -destroy_on_cleanup -id $package_id
  }
} else {
  if {$url ne ""} {
    ::$package_id set_url -url $url
  }
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: