xo::PackageMgr instproc require (public)

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

Defined in /var/www/openacs.org/packages/xotcl-core/tcl/06-package-procs.tcl

Create package object if needed.

Switches:
-url (optional)
Parameters:
package_id (required)

Testcases:
create_folder_with_page, package_normalize_path, 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: