[Bese-devel] what's wrong with the following code?

Friedrich Dominicus frido at q-software-solutions.de
Sun Aug 21 03:28:44 UTC 2005


(defaction shop-login ((login shop-login) username password)
  (setf (login.username login) username
        (login.password login) password)
  (let* ((user-data (check-credentials login))
         (shipping-adr (make-instance 'shipping-adr :adr (car (qss.db::shipping-address user-data)))))
        ;; car is needed because a join slot always returns a list!     
    (inspect login)
    (inspect shipping-adr)
  (if shipping-adr
      (call 'customer-input-page
            :customer-data user-data
            :address shipping-adr
            :payment-details nil)
      (call 'info-message 
            :message "Login failed"))))

The shipping-adr class is defined this way:
(defcomponent address-mixin ()
  ((adr :initarg :adr :accessor adr
        :backtrack t
        :initform (make-instance 'qss.db::shipping-address)))
  (:metaclass standard-component-class))

;; (forget-class :shipping-adr)
(defclass shipping-adr (address-mixin)
  ()
  (:metaclass standard-component-class))

If I inspect login I see the following:
0. CONTINUATION: (IT.BESE.ARNESI::TOPLEVEL-K)
1. CALLING-COMPONENT: #<TRANS-INFO {1001F24851}>
2. PLACE: #<IT.BESE.UCW::PLACE (CONTEXT.WINDOW-COMPONENT
                                *CONTEXT*) {1001391471}>

that's ok, the shipping-adr has the following
0. CONTINUATION: "unbound"
1. CALLING-COMPONENT: "unbound"
2. PLACE: "unbound"

which seems itself reasonable, but then I do the following
(defmethod render-on ((res response) (customer-page customer-input-page))
  (<:h1 "Your adress data: ")
  (render-on res (address customer-page)))

which then calls this:
(defmethod render-on ((res response) (adr shipping-adr))
  (let ((address (adr adr)))
    (inspect adr)
    (<ucw:form :action (edit-address adr)
               (<:table 
                (dolist (item '(street zip city country email))
                  (present-a-slot-as-table-row item (slot-value address item))))
               (<:p
                (<ucw:submit :action (edit-address adr)
                             :value "Edit")))))

This is rendered fine.

But then I push the button and got:
The slot IT.BESE.UCW::PLACE is unbound in the object #<SHIPPING-ADR {10017C2171}>.
   [Condition of type UNBOUND-SLOT]

Restarts:
  0: [SHOW-BACKTRACE] Send the client a backtrace page.
  1: [RETRY] Clearout the response and retry calling the action.
  2: [SERVER-ERROR] Send the client an internal server error page.
  3: [GENERATE-BACKTRACE-FOR-EMACS] Generate a bug report in Emacs.
  

That's of course true, but not what I like to see of course I'd like
to call the next action and go on from there. 

So how am I supposed to build such a action-render-render-action 
chain?

what i want is:
checking the login credentials
if the the customer can be found then show me his/her address
if the data have changed allow to change them 
change the data 
display the changed data
go on wiht the state as if he/she had not changed the address
display e.g the payment terms the customer has taken.
allow changes as needed 
etc.

Help would be very appreciated.

Regards
Friedrich



More information about the bese-devel mailing list