Found a workaround to this:

1st view:
baos=ByteArrayOutputStream() #make an outputstream
cred.save(baos) #store the credential to the outputstream
request.session['user_cred']=baos.toString() #store the string

2nd view:
outstring=String(request.session['user_cred']) #get the string
bais=ByteArrayInputStream(outstring.getBytes()) #make an inputstream with
the string
cred=GlobusCredential(bais) #reconstruct the credential with the inputstream

On Fri, Oct 7, 2011 at 3:12 PM, Javier Guerra Giraldez
<jav...@guerrag.com>wrote:

> On Fri, Oct 7, 2011 at 11:41 AM, django-jython-user <saba...@gmail.com>
> wrote:
> > Hi,
> > I'm having trouble using django sessions objects.
> >
> > so I set the object in one view:
> > request.session['user_cred']=cred #where cred is a GlobusCredential
>
> the session object does automatic pickling of object to store them.
> but then your objects have to be pickleable.  what is a
> GlobusCredential?  is that a Java thing?  is it pickleable?
>
> > Django Version:         1.2.5
> > Exception Type:         AttributeError
> > Exception Value:        'str' object has no attribute 'META'
>
> if the object you're getting was an str, the error would say " 'str'
> object has no attribute 'getIdentity'".  Instead, it seems that
> something _inside_ the GlobusCredential wasn't restored correctly.
>
> again, are you positive that GlobusCredential objects are pickleable?
> probably you'll have to store some info that let you reconstruct or
> refetch the object
>
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to