Hi, Sorry to bother everyone again. I try to keep my questions to a minimum but there's just too much to Zope and Python and I'm feeling a bit overwhelmed. I also apologize for not being more specific with my questions but just I don't know enough to be more specific. The thing I'm trying to do is conceptually very simple but I can't seem to get all the pieces together. I'm trying to create an Executive Information System that puts my client's financial information online with drill down capability. I'd basically like to be able to have Zope accept a URL something like this; http:\\MyZopeServer\IncomeStatement?rgn=80 and have it generate an Income Statement routine for region 80. They have a hierarchical structure with groups, divisions, regions, areas, sales reps, etc. so the code "rgn" might be "grp" or "area". That sounds pretty simple doesn't it? I can't seem to put the pieces together. I was able to write a python module that takes the organization type and number and writes an Income Statement to a file in HTML. I got the project from The Book of Zope working but all the forms seem to be linked to DTML files. It didn't give me any examples on where to get the URL parameters from or how to just return my finished HTML to Zope. I also went through the Template Attribute Language section of The Zope Book and have kind of an understanding on how TAL templates work but I don't see where they get URL parameters from. Having been a programmer for 20 years, I'm most comfortable with programming languages like Python than with TAL or DTML. Ideally, I'd like the above URL to execute my Income Statement function and pass the org type and number. My module could then return the HTML page. The main problem I see with this approach (other than the fact that I can't figure out how to do it) is that I need to connect to the database every time. Also, the Income Statement module returns data appropriate to the SQL user name so I need to have some way to associate a Zope user with an SQL database user. I work at a Microsoft shop and am getting a log of pressure to go with IIS and .Net. There are a number of people here that have already done some similar work in the sales area. I'm in kind of a race to get something put together so I can demo it. That makes it hard because I tend to jump around a lot just trying to get things working without knowing the best approach to take. I guess that's why I've got so many pieces but no pie. So, what's the best approach to take? Should I try to do it with Page Templates and python scripts? Is that efficient? Is the product approach better? Whichever approach is best, I have a ton of questions. Too many to ask for free. I can pay for a few hours of help if anyone is available. I guess what I'd really like is a product that would translate the above URL into a call to a Python function passing in the user info, the database connection, the organization type and number. It doesn't seem like that would be too hard for someone who knows what they're doing. So far, I haven't had much success. Thanks Joe Goldthwaite
On Tue, 2003-11-25 at 22:45, Goldthwaite, Joe wrote:
I'd basically like to be able to have Zope accept a URL something like this; http:\\MyZopeServer\IncomeStatement?rgn=80 and have it generate an Income Statement routine for region 80.
What you want is an IncomeStatment *method* that takes parameters such as rgn, grp, etc. Methods can be stand-alone objects (Python Scripts, ZPT, DTML) or they can be attributes of more complex objects, such as you might define in a product.
That sounds pretty simple doesn't it? I can't seem to put the pieces together. I was able to write a python module that takes the organization type and number and writes an Income Statement to a file in HTML.
That's how it works externally to Zope, you mean? If you were to use a Python Script here, you'd want to *return* HTML or an object capable of rendering it, such as ZPT or DTML. Both templating languages are, themselves, able to take parameters.
I got the project from The Book of Zope working but all the forms seem to be linked to DTML files.
The client doesn't care what is used to process your form, it just cares where to send it. What resides at that URL is entirely up to you.
It didn't give me any examples on where to get the URL parameters from
Querystring parameters are simply attributes of the REQUEST object. The easiest way to learn about the REQUEST object is simply to view it... create a DTML Method called "me" and give it the contents: <dtml-var REQUEST> Now hit server/me. After that, try, server/me?arg1=foo&arg2=bar.
Having been a programmer for 20 years, I'm most comfortable with programming languages like Python than with TAL or DTML.
That's a good thing. Use templating primarily for presentation and Python for pretty much everything else. If it helps, you can think of templates as a syntactically enhanced use of the %s operator. They're just text with named holes where other data gets squeezed in.
Ideally, I'd like the above URL to execute my Income Statement function and pass the org type and number. My module could then return the HTML page. The main problem I see with this approach (other than the fact that I can't figure out how to do it) is that I need to connect to the database every time.
How would you prefer data be accessed?
Also, the Income Statement module returns data appropriate to the SQL user name so I need to have some way to associate a Zope user with an SQL database user.
You could make that a property of the Zope user object or create a Python Script that consists of a user:user mapping.
I work at a Microsoft shop
Boo! Hiss! :-)
and am getting a log of pressure to go with IIS and .Net.
From what I hear, Zope works fine being fronted by IIS.
So, what's the best approach to take? Should I try to do it with Page Templates and python scripts?
Yes.
Is that efficient? Is the product approach better?
Products are Zope's sweet spot, so you'll definitely want to learn about them eventually. But you'll do better at this stage to prototype your system in the ZMI. You'll get visible results much faster. Once it works there, if you want to make it portable or easily replicated, you can port it to a product. That's not difficult.
I guess what I'd really like is a product that would translate the above URL into a call to a Python function passing in the user info, the database connection, the organization type and number.
If this were being done in a product, you'd have several template objects defined (similar to first line) and a method that takes the REQUEST object as a parameter and returns a template object when it's done doing whatever it does: ---- some_template = PageTemplateFile('path/from/product/folder', globals()) ... def IncomeStatement(self, request): ''' You need a docstring here ''' rgn = int(request.form.get('rgn', 0)) if rgn: # do stuff here request['foo'] = bar # <-- pass bar to template return self.some_template ----
It doesn't seem like that would be too hard for someone who knows what they're doing. So far, I haven't had much success.
Like anything, it gets easier as you become familiar with the idioms. HTH, Dylan
Goldthwaite, Joe wrote:
Hi,
Sorry to bother everyone again. I try to keep my questions to a minimum but there's just too much to Zope and Python and I'm feeling a bit overwhelmed. I also apologize for not being more specific with my questions but just I don't know enough to be more specific.
The thing I'm trying to do is conceptually very simple but I can't seem to get all the pieces together. I'm trying to create an Executive Information System that puts my client's financial information online with drill down capability. I'd basically like to be able to have Zope accept a URL something like this; http:\\MyZopeServer\IncomeStatement?rgn=80 and have it generate an Income Statement routine for region 80. They have a hierarchical structure with groups, divisions, regions, areas, sales reps, etc. so the code "rgn" might be "grp" or "area".
That sounds pretty simple doesn't it? I can't seem to put the pieces together. I was able to write a python module that takes the organization type and number and writes an Income Statement to a file in HTML. I got the project from The Book of Zope working but all the forms seem to be linked to DTML files. It didn't give me any examples on where to get the URL parameters from or how to just return my finished HTML to Zope. I also went through the Template Attribute Language section of The Zope Book and have kind of an understanding on how TAL templates work but I don't see where they get URL parameters from.
You generally dont have to worry about URL parameters, Zope does this for you May I suggest the Zope book (available online here: http://zope.org/Documentation/Books/ZopeBook/2_6Edition ). URL parameters are eg. discussed here: http://zope.org/Documentation/Books/ZopeBook/2_6Edition/DTML.stx , "Processing Input from Forms" I think this might help you to come up with more specific questions. If you find the Zope book unclear or unhelpful I'd be glad if you would let me know so I can demystify the offending parts I'm not to clear on your projects needs but it indeed doesn't sound too complicated hth, peter
Having been a programmer for 20 years, I'm most comfortable with programming languages like Python than with TAL or DTML. Ideally, I'd like the above URL to execute my Income Statement function and pass the org type and number. My module could then return the HTML page. The main problem I see with this approach (other than the fact that I can't figure out how to do it) is that I need to connect to the database every time. Also, the Income Statement module returns data appropriate to the SQL user name so I need to have some way to associate a Zope user with an SQL database user.
I work at a Microsoft shop and am getting a log of pressure to go with IIS and .Net. There are a number of people here that have already done some similar work in the sales area. I'm in kind of a race to get something put together so I can demo it. That makes it hard because I tend to jump around a lot just trying to get things working without knowing the best approach to take. I guess that's why I've got so many pieces but no pie.
So, what's the best approach to take? Should I try to do it with Page Templates and python scripts? Is that efficient? Is the product approach better? Whichever approach is best, I have a ton of questions. Too many to ask for free. I can pay for a few hours of help if anyone is available.
I guess what I'd really like is a product that would translate the above URL into a call to a Python function passing in the user info, the database connection, the organization type and number. It doesn't seem like that would be too hard for someone who knows what they're doing. So far, I haven't had much success.
Thanks Joe Goldthwaite
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Dylan Reinhardt -
Goldthwaite, Joe -
Peter Sabaini