RE: [Zope] Return values for html display?
-----Original Message----- From: jiva@devware.com [mailto:jiva@devware.com] Sent: Sunday, December 05, 1999 1:32 AM To: zope@zope.org Subject: [Zope] Return values for html display?
So, I have set up some external methods that do some stuff, and I ultimately want to display html from them. However, I find the only way I can do this is to return it from my function. print() seems only to send it to the zserver log.
Actually, it writes it to stdout, which end up in the logs.
Soooo, my question is, is this by design?
Yes.
Is there some way to get print() to actually shoot html to the page the end user sees?
Probably not.
Is there a reason I wouldn't want to do this?
No, it's quite useful. What you're looking for is RESPONSE.write(). Note, error's don't get sent to the browser in their usualy nicely formated way if you use RESPONSE.write(). Everything else works the same however (ie, the transaction gets aborted, the exception can be caught by a <dtml-try> etc..) -Michel
Hi All, I have a question about adding additional information to a user object (or another way to do this) I want to have an attribute for each user. i.e. each user will have a subject attribute, so when they view a certain page, only messages of that subject appear Since this is only one bit of info, I don't want to make a separate permission for each subject, because that would be very un-extensible So what's the best way to do this: 1)Do i try to hack info into the authenticated user object (A follow-up question is how do i go about doing this, where is that object defined?) 2) Do i associate each user with a database entry with the additional info (This seems like a bit of overkill for my purposes) 3)Do i add the information into the product I am working with (while this would work, i am not how to insure the information between then user folder and my product are the same) Or do I do it some other way? I was just wondering what people think. Thanks a lot -Scott Kaplan On Mon, 6 Dec 1999, Michel Pelletier wrote:
-----Original Message----- From: jiva@devware.com [mailto:jiva@devware.com] Sent: Sunday, December 05, 1999 1:32 AM To: zope@zope.org Subject: [Zope] Return values for html display?
So, I have set up some external methods that do some stuff, and I ultimately want to display html from them. However, I find the only way I can do this is to return it from my function. print() seems only to send it to the zserver log.
Actually, it writes it to stdout, which end up in the logs.
Soooo, my question is, is this by design?
Yes.
Is there some way to get print() to actually shoot html to the page the end user sees?
Probably not.
Is there a reason I wouldn't want to do this?
No, it's quite useful. What you're looking for is RESPONSE.write(). Note, error's don't get sent to the browser in their usualy nicely formated way if you use RESPONSE.write(). Everything else works the same however (ie, the transaction gets aborted, the exception can be caught by a <dtml-try> etc..)
-Michel
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope No cross posts or HTML encoding! (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Mon, 6 Dec 1999, scott kaplan wrote:
Hi All, I have a question about adding additional information to a user object (or another way to do this) I want to have an attribute for each user. i.e. each user will have a subject attribute, so when they view a certain page, only messages of that subject appear
Could you just set the subject in a cookie, or in a session object? Pavlos
I can set the subject in a cookie, or somether session object, but i still need to store the info of which subejct is associated with which user to set the cookie, unless I am missing something. -Scott On Mon, 6 Dec 1999, Pavlos Christoforou wrote:
Could you just set the subject in a cookie, or in a session object?
Pavlos
On Mon, 6 Dec 1999, scott kaplan wrote:
Hi All, I have a question about adding additional information to a user object (or another way to do this) I want to have an attribute for each user. i.e. each user will have a subject attribute, so when they view a certain page, only messages of that subject appear
On Mon, 6 Dec 1999, scott kaplan wrote:
I can set the subject in a cookie, or somether session object, but i still need to store the info of which subejct is associated with which user to set the cookie, unless I am missing something. -Scott
Probably I am missing something (lately I am missing a lot of things, including vacation and my mind). I thinking of storing this info in an SQLSession. I suppose when that info is available it is stored in the session object and subsequent requests include the attribute in the REQUEST object. If you use SQLSession you will be able to query the db directly too for modifications etc. On the other hand if you have an external list of which users map to what subjects then maybe you can use TinyTable to store that info directly. I have strong feeling I am off topic ... Pavlos
On Mon, 6 Dec 1999, scott kaplan wrote:
I can set the subject in a cookie, or somether session object, but i still need to store the info of which subejct is associated with which user to set the cookie, unless I am missing something.
If you are pulling your user information from an external source (LDAP, RDBMS etc), then it can simply be done by pulling the subject from the same source. Just create a DTML method somewhere high up called something like userSubject that queries your database and returns the subject for that user. This method can also be used if you are using the default userfolder, but means you have two places to update things instead of one. -- ___ // Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au // E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au //__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen
Use UserDb, and then make some quick hacks to the database structure and to the various forms. If it is your first time inside a Zope module, it might take you a few hours to work it out, but it is easy to make changes from there. The forms are in the .dtml documents in the Product directory, and teh queries are at the bottom of UserDb.py. Enjoy. Actually, I suppose that current wisdom would say that you should use the Generic User Folder to do this, but I have no experience whatsoever with that product, and UserDb is solid and easy to work with. --sam scott kaplan wrote:
Hi All, I have a question about adding additional information to a user object (or another way to do this) I want to have an attribute for each user. i.e. each user will have a subject attribute, so when they view a certain page, only messages of that subject appear
Since this is only one bit of info, I don't want to make a separate permission for each subject, because that would be very un-extensible
So what's the best way to do this:
1)Do i try to hack info into the authenticated user object (A follow-up question is how do i go about doing this, where is that object defined?)
2) Do i associate each user with a database entry with the additional info (This seems like a bit of overkill for my purposes)
3)Do i add the information into the product I am working with (while this would work, i am not how to insure the information between then user folder and my product are the same)
Or do I do it some other way? I was just wondering what people think. Thanks a lot -Scott Kaplan
On Mon, 6 Dec 1999, Michel Pelletier wrote:
-----Original Message----- From: jiva@devware.com [mailto:jiva@devware.com] Sent: Sunday, December 05, 1999 1:32 AM To: zope@zope.org Subject: [Zope] Return values for html display?
So, I have set up some external methods that do some stuff, and I ultimately want to display html from them. However, I find the only way I can do this is to return it from my function. print() seems only to send it to the zserver log.
Actually, it writes it to stdout, which end up in the logs.
Soooo, my question is, is this by design?
Yes.
Is there some way to get print() to actually shoot html to the page the end user sees?
Probably not.
Is there a reason I wouldn't want to do this?
No, it's quite useful. What you're looking for is RESPONSE.write(). Note, error's don't get sent to the browser in their usualy nicely formated way if you use RESPONSE.write(). Everything else works the same however (ie, the transaction gets aborted, the exception can be caught by a <dtml-try> etc..)
-Michel
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope No cross posts or HTML encoding! (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope No cross posts or HTML encoding! (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (5)
-
Michel Pelletier -
Pavlos Christoforou -
Sam Gendler -
scott kaplan -
Stuart 'Zen' Bishop