I'm working on a modified login widget that looks very much like a
dataform, but doesn't have the same inheritance hierarchy.  Like
dataform, it allows one to define the form data by defining a view.
However, I've run into trouble with deserializing the generated data
object.

Here's my view:

(in-package :simple-blog)

(defview my-login-view (:type form :persistp nil
                                   :buttons '((:submit . "Login") :cancel)
                                   :caption "Login"
                                   :focusp t)
  (email :requiredp t)
  (password :requiredp t
            :present-as password
            :writer (lambda (pwd obj)
                      (setf (slot-value obj 'password)
                            (hash-password pwd)))))

I'm running into problems in the DESERIALIZE-OBJECT-FROM-PARSED-VALUES
label in the UPDATE-OBJECT-VIEW-FROM-REQUEST method (request-
deserialization.lisp):

(deserialize-object-from-parsed-values (parsed-values &key write-
delayed)
               "Accepts an an association list of field-info
               structures and parsed-values, and records each parsed
               value in the corresponding field's object slot."
               (hunchentoot:log-message :debug "parsed values: ~A" parsed-
values)
               (mapc (lambda (field-info-parsed-value-pair)
                       (destructuring-bind (field-info . parsed-value)
                           field-info-parsed-value-pair
                         (let ((field (field-info-field field-info))
                               (obj (field-info-object field-info)))
                           (hunchentoot:log-message :debug "field: ~A, obj: ~A" 
field obj)
                           (when (typep (view-field-presentation field) 
'form-presentation)
                             (if (form-view-field-writer-delayed-p field)
                                 (when write-delayed
                                   (write-value field parsed-value obj))
                                 (unless write-delayed
                                   (write-value field parsed-value obj)))))))
                     parsed-values))

Notice the log-message expression just inside the inner LET
expression: the output I get in the hunchentoot log shows that the
label thinks the slot symbols are interned in the :WEBLOCKS package
instead of in :SIMPLE-BLOG, which leads to an error when the a setf of
the corresponding slot-value of the newly created object is attempted:

Log:
[2009-03-19 17:44:49 [DEBUG]] field: #<FORM-VIEW-FIELD
WEBLOCKS:PASSWORD {C20D491}>, obj: #<STANDARD-CLASS #:G1801>

Error message in browser:
SIMPLE-ERROR: When attempting to set the slot's value to
"962012D09B8170D912F0669F6D7D9D07" (SETF of SLOT-VALUE), the slot
WEBLOCKS:PASSWORD is missing from the object #<STANDARD-CLASS
#:G1801>.

What's going on here?  Is there a bug in the view compiler that
inserts the request headers with the wrong names, assuming that all
views are defined in :WEBLOCKS?  I'm going to keep looking for myself,
but I thought it in everyone's interest for me to ask here.

Below is the full backtrace (which is somewhat mangled by copy-paste,
but given the above, anyone familiar with weblocks at all should be
able to make some sense of):

31      MAP-BACKTRACE
#<CLOSURE (LAMBDA (SB-DEBUG::FRAME)) {B2116CD}>
30      BACKTRACE-AS-LIST
536870911
29      (FAST-METHOD HANDLE-ERROR-CONDITION (WEBLOCKS-WEBAPP T))
#<unavailable argument>
#<unavailable argument>
#<unavailable argument>
When attempting to set the slot's value to
"962012D09B8170D912F0669F6D7D9D07" (SETF of SLOT-VALUE), the slot
WEBLOCKS:PASSWORD is missing from the object #<STANDARD-CLASS
#:G1801>.
28      (FLET LAMBDA13)
When attempting to set the slot's value to
"962012D09B8170D912F0669F6D7D9D07" (SETF of SLOT-VALUE), the slot
WEBLOCKS:PASSWORD is missing from the object #<STANDARD-CLASS
#:G1801>.
27      SIGNAL
When attempting to set the slot's value to
"962012D09B8170D912F0669F6D7D9D07" (SETF of SLOT-VALUE), the slot
WEBLOCKS:PASSWORD is missing from the object #<STANDARD-CLASS
#:G1801>.
26      ERROR
~@<When attempting to ~A, the slot ~S is missing from the ~ object
~S.~@:>
25      (FAST-METHOD SLOT-MISSING (T T T T))
#<unused argument>
#<unused argument>
#<unused argument>
#<STANDARD-CLASS #:G1801>
PASSWORD
SETF
962012D09B8170D912F0669F6D7D9D07
24      (LAMBDA (.ARG0. .ARG1. .ARG2. .ARG3. &MORE .DFUN-MORE-
CONTEXT. .DFUN-MORE-COUNT.))
#<STANDARD-CLASS STANDARD-CLASS>
#<STANDARD-CLASS #:G1801>
PASSWORD
SETF
-314918295
1
23      SET-SLOT-VALUE
#<STANDARD-CLASS #:G1801>
PASSWORD
962012D09B8170D912F0669F6D7D9D07
22      (LAMBDA (PWD OBJ))
qwer
#<STANDARD-CLASS #:G1801>
21      (LABELS WRITE-VALUE)
#<FORM-VIEW-FIELD WEBLOCKS:PASSWORD {C20D491}>
qwer
#<STANDARD-CLASS #:G1801>
20      (LABELS DESERIALIZE-OBJECT-FROM-PARSED-VALUES)
((#<FIELD-INFO (WEBLOCKS:PASSWORD) {B1EB4F9}> . qwer) (#<FIELD-INFO
(WEBLOCKS:EMAIL) {B1EB4D9}> . asdf))
WRITE-DELAYED
NIL
19      (FAST-METHOD UPDATE-OBJECT-VIEW-FROM-REQUEST (T T))
#<unused argument>
#<unused argument>
#<STANDARD-CLASS #:G1801>
#<FORM-VIEW {B88B8B9}>
18      (FAST-METHOD LOGIN-SUBMIT-ACTION (LOGIN))
#<unused argument>
#<unused argument>
#<LOGIN "16">
17      (LAMBDA (&KEY SUBMIT CANCEL &ALLOW-OTHER-KEYS))
SUBMIT
Login
CANCEL
NIL
16      ACTION-TXN-HOOK
(#<FUNCTION (LAMBDA #) {AE8A97D}>)
15      (FAST-METHOD HANDLE-CLIENT-REQUEST (WEBLOCKS-WEBAPP))
#<unavailable argument>
#<unavailable argument>
#<SIMPLE-BLOG {A8FC1C1}>
14      (FAST-METHOD HANDLE-CLIENT-REQUEST AROUND (T))
#<unavailable argument>
#S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD
WEBLOCKS:HANDLE-CLIENT-REQUEST #)> :PV NIL :NEXT-METHOD-CALL NIL :ARG-
INFO (1))
#<SIMPLE-BLOG {A8FC1C1}>
13      (FAST-METHOD PROCESS-REQUEST (T))
#<unavailable argument>
#<unavailable argument>
#<REQUEST {B1D5D49}>
12      (LAMBDA (.ARG0.))
#<REQUEST {B1D5D49}>
11      (FAST-METHOD PROCESS-CONNECTION (ACCEPTOR T))
#<unavailable argument>
#<unavailable argument>
#<WEBLOCKS-ACCEPTOR (host *, port 8080)>
#<STREAM-USOCKET {A97BA81}>
10      (FAST-METHOD PROCESS-CONNECTION (WEBLOCKS-ACCEPTOR T))
#<unavailable argument>
#S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD
HUNCHENTOOT:PROCESS-CONNECTION #)> :PV NIL :NEXT-METHOD-CALL NIL :ARG-
INFO (2))
#<WEBLOCKS-ACCEPTOR (host *, port 8080)>
#<STREAM-USOCKET {A97BA81}>
9       (FAST-METHOD PROCESS-CONNECTION AROUND (ACCEPTOR T))
#<unavailable argument>
#S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD
HUNCHENTOOT:PROCESS-CONNECTION #)> :PV NIL :NEXT-METHOD-CALL #S(SB-
PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION #> :PV NIL :NEXT-METHOD-
CALL NIL :ARG-INFO (2)) :ARG-INFO (2))
#<WEBLOCKS-ACCEPTOR (host *, port 8080)>
#<STREAM-USOCKET {A97BA81}>
8       (FLET WITH-MUTEX-THUNK)
7       (FLET WITHOUT-INTERRUPTS-BODY-[CALL-WITH-MUTEX]478)
6       CALL-WITH-MUTEX
#<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK) {B4EAF205}>
#S(SB-THREAD:MUTEX :NAME thread result lock :%OWNER #<THREAD
"Hunchentoot worker (client: 192.168.0.101:61832)" RUNNING {A97D111}
> :STATE 1)
#<THREAD "Hunchentoot worker (client: 192.168.0.101:61832)" RUNNING
{A97D111}>
T
5       (LAMBDA ())
4       foreign function: #x806160C
3       foreign function: #x805213D
2       foreign function: #x8058F3D
1       foreign function: #xB7FBF1A2




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to