Title: Zope, Threads and Signals It all began when I was a small child, but I'll skip ahead a bit Last night I wrote a network client class with plans to use it as an External Method in Zope. Works great from the command line. My first real Python program. Mom and Dad were so proud! However, when I plugged it into Zope and tried to call it from a document method, I got this: Error Type: ValueError Error Value: signal only works in main thread Gack!! Um... Silly me, but I wrote all this code to use sigalarm and blocking I/O. Anyone know how I can overcome this great adversity, aside from rewriting it all to use non-blocking I/O? Know of any good examples of External Method network clients you could point me at? Or would making it a Zope Product somehow fix everything? (Sorry, I had to ask...) -cw- -- Charlie Wilkinson TRIS Development Systems Administrator IS:SD:CT:CC:TD Phone: 202-283-3241 MSMail: [EMAIL PROTECTED] SMTP: [EMAIL PROTECTED] Home: [EMAIL PROTECTED] This message constructed from 90% post-consumer electrons.
Title: RE: [Zope] Splitting ZSQL results across pages -Original Message- From: Dieter Maurer [[EMAIL PROTECTED]] John Morton writes: I'd like to split the output of a ZSQL query across different instances of a page in the same fashion as zope.org does with ZCatalog output, but I can't for the life of me find any documentation on how it's done. Does anyone know the magic incarntations or where the documents are? Look at the in tag's batching features. Or for something with a gentler learning curve: http://www.zope.org/Documentation/Guides/ZSQL Go there and read the section on Creating Search Interfaces. Zope will magically create a search query form and a table-formatted batching output method on the back end, based on an SQL Query method of your own design. So read that, do that, and then look at the methods it creates. I found it very useful in getting up to speed on how to roll my own batching DTML methods. -cw- PS - (OT rant warning) I have set everywhere I know of to tell %^#$@! Outlook 2k to send PLAIN TEXT, but it's apparently WAY TO SMART to simply let me do ASCII and leave me be. If you have a solution (especially if it involves high explosives), I'm all ears. I don't hafta put up with this kinda crap from my *nix boxes. (Mutter grumble...) If I could get an Exchange(r)(tm)(c2000) client running on my Linus W/S, this thing would be history sooo fast. What a waste of a Pentium3 box... (I feel a little better now, thanks.) -- Charlie Wilkinson TRIS Development Systems Administrator IS:SD:CT:CC:TD Phone: 202-283-3241 MSMail: [EMAIL PROTECTED] SMTP: [EMAIL PROTECTED] Home: [EMAIL PROTECTED] This message constructed from 90% post-consumer electrons.
Title: RE: [Zope] LoginManager UserSources Hi Danny, I don't think the question applies, as you are prettymuch free to build a UserSource to anything you want. Of course, with that freedom comes aggrevation. ;-/ There is ready documentation on the Zope site for interfacing LM to SMB for authentication. I've gotten it working with Postgres (with crypted passwords no less!) It took me a couple of weeks on and off to finally get that going. Yes, it was painful, especially having no prior experience with GUF (or much experience with Zope, for that matter...) I've not made it a very high priority, but I'm working on a LoginManager/PostgreSQL walkthrough hoping that I might save someone else some grief. That info should be easy to translate for any other datasource full of users you might have in mind. Interested? -cw- -Original Message- From: Danny William Adair [[EMAIL PROTECTED]] Sent: Wednesday, August 02, 2000 4:51 AM To: [EMAIL PROTECTED] Subject: [Zope] LoginManager UserSources What UserSources are available as of today for the LoginManager to use? How do they work? TIA Danny
Title: RE: [Zope] Change db connect string in python or dtml Have you tried: create a new instance of a database connection alongside the old one, then point your SQL methods at the new connection. When you have them all switched over, delete the old connection. -cw- -Original Message- From: Magnus Heino [[EMAIL PROTECTED]] Sent: Wednesday, August 02, 2000 5:50 AM To: [EMAIL PROTECTED] Subject: [Zope] Change db connect string in python or dtml Hi. I have an instance of a 'Z MySQL Database Connection' called mysql. How can I change the 'Database Connection String' and then then try to connect, either in dtml or python? -- /Magnus Heino
Title: RE: [Zope] LoginManager UserSources -Original Message- From: Kyler B. Laird [[EMAIL PROTECTED]] On Wed, 2 Aug 2000 15:13:45 -0400 you wrote: I've gotten it working with Postgres (with crypted passwords no less!) It took me a couple of weeks on and off to finally get that going. Yes, it was painful, especially having no prior experience with GUF (or much experience with Zope, for that matter...) I've not made it a very high priority, but I'm working on a LoginManager/PostgreSQL walkthrough hoping that I might save someone else some grief. That info should be easy to translate for any other datasource full of users you might have in mind. Interested? What I read: I see you're starving. Are you interested in some food? Well, probably more like, Are you interested in Spam and CheezWiz on saltines? ;-) Yes! I'm desperate for a way to use Oracle and/or X.500 databases for authentication (and authorization and ...). I would be happy to pay someone to hold my hand through creating such a product. (This is one of the first things I built into Apache so many years ago.) LM is a fantastically versatile product, which also makes it a potentially major PITA. Not having sufficient documentation makes it a recipe for insanity. (Save yourself, it's too late for me!) I'm a bit fuzzy on this, though. Shouldn't there be an easy way to generalize databases for this purpose? Why do we need PostgreSQL, Oracle, Gadfly, ... versions? I'd like to be able to just choose a connection ID and go. The gist of it is this: First you create (or use the default) UserSource. It's basically an empty box that is used to contain the various methods used to authenticate a user. You can have more than one UserSource, meaning you could have US's validating against SMB, LDAP, UNIX passwd, NIS, etc. (i.e., pretty much anything that Python will talk to) all running in conjunction. If validation fails against the first US, LM will simply drop through to the next and so on, until it either validates the user successfully, or drops out the bottom and denies access. You will first need to create a method for determining if a user exists. If the user exists, return 1, otherwise 0. A second method is required to take the entered username and actually look up a password, validate it against the password entered by the user and return success (1) or failure (0). A third method is used to look up the user's roles and return them as a list. These roles should match up against either default Zope roles, or preferably roles you've created for the purpose. You then lock down permissions on the desired folders/objects so that only users with the correct roles can access those objects. And lastly, a forth method is needed to return a list of valid net domains from which the user is allowed to log in. If you don't want to restrict logins by domain, then simply return an empty list. So, regarding your question about why should it matter which database, it doesn't. Not much anyways. US covers a much broader spectrum than just databases. As I indicated above, pretty much anything you could conceive of to store user data in, LM can interface to it. For some US's you may need to craft one or more external methods in Python. If it's a DBMS like Postgres, Oracle, MySQL, MSSQL, you will need a database connection method, and you will need SQL methods to fulfill the above four validation steps. Which brand of database you connect to is likely only going to affect minor issues of SQL syntax within your methods, if that. The way your user data is *structured* will have more impact than which database you use. That leaves out a ton of detail, but should hopefully answer your immediate questions and then some. Feel free to drop me a note at [EMAIL PROTECTED] and we can further discuss getting your LM up and running. -cw-
Title: RE: [Zope] Backing Up Zope (was: Re: [Zope] Data.fs.lock?) Just to start by pointing out the bloody obvious: - Restoring from backup means you lose all data between backup date/time and system failure. Sucks, but it beats losing *all* your data. (RAID5 anyone?) - With that in mind, *consistency* of the backup database takes the highest priority. All existing transactions should be fully completed - no half-done updates, etc. It seems to me that the easiest way to get there with ZODB might be to just make a simple file copy of the database and have some kind of integrity checking tool to run against the static backup copy to weed out the junk. Is this possible, does it already exist? Probably a dumb question, but would Zope itself do this if you fired it off against an inconsistent ZODB? Another random thought is that if ZODB transactions and writes are atomic, than none of this should be an issue. Anyone know the answer to that one? -cw- -Original Message- From: Chris Withers [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 29, 2000 7:49 AM To: Erik Enge Cc: Oleg Broytmann; Zope Mailing List Subject: [Zope] Backing Up Zope (was: Re: [Zope] Data.fs.lock?) Erik Enge wrote: On Thu, 29 Jun 2000, Chris Withers wrote: Hmm, about extending this so you have 'rotating data.fs files' in the same way you have rotating log files? In general, yes :-). Do you think it would be solving the right problem the right way? I think so, but that's only my view. If anyone's got any better ideas, please pipe up :-) cheers, Chris ___ Zope maillist - [EMAIL PROTECTED] 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 )
Title: RE: [Zope] Backing Up Zope (was: Re: [Zope] Data.fs.lock?) -Original Message- From: Erik Enge [mailto:[EMAIL PROTECTED]] On Thu, 29 Jun 2000, Jeff K. Hoffman wrote: It is my understanding that the ZODB on disk is always in a consistent state; Jim has said, in the past, that you can simply make a copy of Data.fs, even while Zope is running, without problems. But the Data.fs has to be updated sometimes. And if you read from a file that is changing, the integrity of your data isn't. How can you make sure that the file is not written to during a certain period of time? You can't? You can. This would be consistent with atomic updates. What it means is that a transaction is not written to the Data.fs file until it has completed, and when it is finally written out, it's done as an atomic operation, i.e. at the system level it is a single write operation and nothing else happens on the system until it completes. From that you can infer that if you were reading the Data.fs file (making your backup copy) at the same time, it would be impossible to read the file in the middle of an update. If both read and write requests hit Data.fs at essentially the same time, one goes first and the other waits until the first completes. So if the write gets first shot, the read will block until the write (meaning a completed transaction/update) finishes, and your read will include that last update. If your read gets first shot, then it will not include the update. You will under no circumstances get *half* an update. One of the other things that makes this possible is ZODB being of a journaling nature. i.e., all updates are *appended* to Data.fs. This is why you must periodically pack the database, which conglomerates all the updates back into the base datastore (or whatever those wacky Zopistas call it. ;) that comprises the first part of the Data.fs file. I think that's all correct. Someone please throttle me senseless if not. :-) -cw-
Title: RE: [Zope] Q: LoginManager and SQL-US? Thanks to Dan Pierson and J.Atwood for pointing me at the GUF/SQL howto. I've beating my head against LM since. I even looked at the source code (which might be more useful if I spoke Python... Anyway, here's what I think I've figured out: Four methods must be created under a UserSource, whether DTML method, external, or whatever: userExists - passed 'username', return 1 if exists. userAuthenticate - passed 'username', 'password', return 1 if valid user. userRoles - passed 'username', return user roles in either space-delimited string, or list. userDomains - passed 'username', return either a list of valid domains (example?) or an empty list/string(?) to leave it wide open. How is that? Am I even getting close? It's worth noting that I still haven't been able to get LM working on either of two installs. At home I got past userExists and userAuthenticate, but then kept getting Forbidden. It appears that I'm not successfully returning a list of roles back to the UserSource code. (When I uncomment the stuff to report that from ForbiddenPage, my roles are empty.) But is it possible that the real problem is the domains, or something else? At work, I can't seem to get past the login screen. I've tried dropping dtml-raise ... and python raise all over the damn place and it appears that program flow is going nowhere near those four methods or their wrappers in UserSource.py. The traceback shows: Traceback (innermost last): File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 179, in publish File /usr/local/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook (Object: ElementWithAttributes) File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 151, in publish File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/BaseRequest.py, line 446, in traverse File /usr/local/Zope-2.1.6-src/lib/python/Products/LoginManager/LoginManager.py, line 149, in lm_unauth (Object: SheetProviderContainer) File /usr/local/Zope-2.1.6-src/lib/python/OFS/DTMLDocument.py, line 166, in __call__ (Object: loginForm) File /usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__ (Object: loginForm) File /usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Raise.py, line 128, in render (Object: 'LoginRequired') LoginRequired: (see above) Clue anyone? TIA, Charlie -Original Message- From: Dan L. Pierson [mailto:[EMAIL PROTECTED]] Wilkinson Charlie E writes: 1. Can LoginManager be (easily?) made to meet my specific need? Probably, it includes a GenericUserSource, which is essentially a clone of Generic User Folder (see below). 2. Has anyone done an SQL UserSource yet, or can anyone give me a clue how to make one? You should look at Generic User Folder, and the HowTo that tell how to set it up with Postgressql. Basically, you need to create a number of SQLMethods to query your database and some wrappers for these methods. The SQLMethods are the only thing that has to care about the details of your database format.
Title: Q: LoginManager and SQL-US? Ok, I've got this legacy database app (VisualBasic and Access - Bleck!) that I'm moving to Apache/Zope/PostgreSQL. One of the existing database tables is user info, i.e. userid, password, real name, an account disabled boolean, etc. I've figured out a really stupid way to solve the problem, essentially doing queries against the user table and having conditionals in every DTML object to determine if the user should be there or not. (Actually, I negated some of that silliness by incorporating SQLSession into the mix.) Still, I'm faced with needing some way to check the user/session against each requested object. And no, there's not much access granularity here - the user should either have access to the whole folder, or not. LoginManager looks promising, but I'm still enough of a Zope newbie that I've hit a bit of a roadblock, boiling down (boiled roadblock?!?) to 2 fundemental questions: 1. Can LoginManager be (easily?) made to meet my specific need? 2. Has anyone done an SQL UserSource yet, or can anyone give me a clue how to make one? I've tried creating another US, but after that Zope just sits there, quietly mocking me. I did read the API stuff and that actually makes a little sense to me, but I don't know what types of objects (or external methods?) would need to be created as part of a new US interface. In other words, I more or less understand the API calls, I can do SQL queries in my sleep, but how does one tie it all together into a new US? Does it involve (*shudder*) writing Python? ;) I'd be happy to share back any useful results of this exercise. Thanks for any help, Charlie -- Charlie Wilkinson - TRIS Development Systems Administrator IS:SD:CT:CC:TD Phone: 202-283-3241 MSMail: Charlie E Wilkinson mailto:Charlie E Wilkinson SMTP: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Home: [EMAIL PROTECTED] This message constructed from 90% post-consumer electrons.
Title: Clear Day Greetings, I've dug around, but not found (or not grokked) the solution to thisparticular puzzle. Could someone more knowledgeable provide a littleenlightenment? In the top level folder (root) I have a dtml method title templatethat contains html code and dtml vars that are (intended to be)populated by properties of various subfolders as well as a value ortwo passed directly. The title template is "called" from dtmlmethods in the root and sub-folders using something like: dtml-var "title_block(app_screen = 'Main Screen')" I have no problem getting at the title template from any of the dtmlmethods. (Thanks to acquistion, yes?) However, I get Zope KeyErrors indicating that the title template isnot seeing the sub-folder properties in its namespace, when I plugthe above code into a dtml method contained in one of those sub-folders. Here's the title_block code: CENTERtable border=1dtml-if "_.has_key('titleblock_bg')" bgcolor="dtml-var titleblock_bg"dtml-else bgcolor="#55"/dtml-ifTRTD align=center FONT size=7dtml-if "_.has_key('title_fg')" color="dtml-var title_fg"dtml-else color="#009900"/dtml-ifdtml-var app_title/FONTBR FONT size=4dtml-if "_.has_key('subt_fg')" color="dtml-var subt_fg"dtml-else color="#009900"/dtml-ifdtml-var app_subt/FONTHR FONT size=5dtml-if "_.has_key('screen_fg')" color="dtml-var screen_fg"dtml-else color="#009900"/dtml-ifdtml-var app_screen/FONT/TD/TR/TABLE/CENTER (Ok, try not to laugh too hard - I'm Zope newbie...) Some values above are optional (the has_key stuff). Values likeapp_screen may be passed explicitly as literals. The rest (likeapp_title) was intended to be grabbed from the folder/sub-folderproperties I set up for that purpose. So, two questions: 1. Is there a simple way to pass the appropriate sub-folderproperties namespace from a dtml method contained in that sub-folderto the title_block dtml method contained in the root folder? Anexample would be tremendously helpful. 2. Is there a better way to do what I'm trying to do?Thanks for any help, Charlie-- Charlie Wilkinson - TRIS Development Systems Administrator IS:SD:CT:CC:TDPhone: 202-283-3241 MSMail: Charlie E Wilkinson SMTP: [EMAIL PROTECTED] Home: [EMAIL PROTECTED] This message constructed from 90% post-consumer electrons.