Mailing List Archive

select: 'forgot Session' OR 'cannot concatenate 'str' and 'NoneType' objects'
Hi together,

At first: Sorry for my funny english (I truancy all too often).

This python-script don't work fine and I've no idea, why?

I just want to add a simple session with this:

request = container.REQUEST
session = request.SESSION
form = request.form
errors = []
# ac_name exists, because login was just before
auth_name = form.get('__ac_name')

# the data base connect works, definetly
for i in context.select_rights_from_partner(auth = auth):
x_rights = i['rights']
session.set('sess_rights', x_rights)
else:
errors.append('Your auth_name is not in database.')

if errors:
return context.no_x_rights(errors=errors)
else:
return context.okay()

# END
My Problem seems to be here:
for i in context.select_rights_from_partner(auth = auth):
=> than comes:
Error Value: cannot concatenate 'str' and 'NoneType' objects'

But, when I try this (in the same line:)
for i in context.select_rights_from_partner(auth = str(auth)):
=> No Session will set.

I have no idea at all.

Thx for help.

Greeting from Germany.

Siggi.



--
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db
Re: select: 'forgot Session' OR 'cannot concatenate 'str' and 'NoneType' objects' [ In reply to ]
Siegfried Achtermann wrote:
> My Problem seems to be here:
> for i in context.select_rights_from_partner(auth = auth):
> => than comes:
> Error Value: cannot concatenate 'str' and 'NoneType' objects'
>
> But, when I try this (in the same line:)
> for i in context.select_rights_from_partner(auth = str(auth)):
> => No Session will set.

Sounds like 'auth' isn't what you expect it to be...

What does the ZSQL method look like?

Chris

--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk

_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db