From greg.mccall at telstra.com Thu Sep 5 19:21:23 2002 From: greg.mccall at telstra.com (Greg McCall) Date: Thu, 5 Sep 2002 19:21:23 +1000 Subject: [albatross-users] Should I consider Albatross if I allready use Zope Message-ID: <000801c254bd$9b84a9b0$bc3d30cb@greg> Hi Does anyone have comments on advantages/disadvantages between Zope and Albatross? Cheers Greg -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrewm at object-craft.com.au Wed Sep 11 11:33:43 2002 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 11 Sep 2002 11:33:43 +1000 Subject: [albatross-users] Should I consider Albatross if I allready use Zope In-Reply-To: Message from "Greg McCall" of "Thu, 05 Sep 2002 19:21:23 +1000." <000801c254bd$9b84a9b0$bc3d30cb@greg> References: <000801c254bd$9b84a9b0$bc3d30cb@greg> Message-ID: <20020911013343.E702A3C9B1@coffee.object-craft.com.au> >Does anyone have comments on advantages/disadvantages between Zope and >Albatross? The goals with Albatross and Zope are very different. I don't have a lot of experience with Zope, but my impression is that it tries to be all things to all people. Albatross, on the other hand, attempts to solve a smaller set of problems (session management, templating, separation of logic and presentation, etc). The intention is that it is easy for people to understand it's code and extend it, if need be, in the direction they require. Someone who already knows Zope might choose Albatross for applications where the complexity of Zope is unwarranted, or in an environment where installing Zope is problematic (for example, third-party web hosting), or where the applications will be maintained by developers who haven't been indoctrinated to the Zope way... 8-) -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From gnb at itga.com.au Fri Sep 13 15:31:58 2002 From: gnb at itga.com.au (Gregory Bond) Date: Fri, 13 Sep 2002 15:31:58 +1000 Subject: [albatross-users] complete newbie al-for / template problem.... Message-ID: <200209130531.PAA05004@lightning.itga.com.au> I'm a complete newbie when it comes to albatross, but the following script is giving errors I don't understand. s = '''
''' import albatross ctx = albatross.SimpleContext('.') albatross.Template(ctx, '', s).to_html(ctx) ctx.flush_content() Traceback (most recent call last): File "t.py", line 15, in ? albatross.Template(ctx, '', s).to_html(ctx) File "/usr/local/lib/python2.1/site-packages/albatross/template.py", line 283, in __init__ raise TemplateError('%s:%s: "%s"; unexpected "%s" end tag' \ albatross.template.TemplateError: :7: "/al-for"; unexpected "al-for" end tag I've stared and stared at this, and compared it to the popview example, and I'm stumped. Sign me confused.... Greg. From djc at object-craft.com.au Fri Sep 13 17:03:29 2002 From: djc at object-craft.com.au (Dave Cole) Date: 13 Sep 2002 17:03:29 +1000 Subject: [albatross-users] complete newbie al-for / template problem.... In-Reply-To: <200209130531.PAA05004@lightning.itga.com.au> References: <200209130531.PAA05004@lightning.itga.com.au> Message-ID: gnb> I'm a complete newbie when it comes to albatross, but the gnb> following script is giving errors I don't understand. gnb> gnb> s = ''' gnb> gnb> gnb> gnb> gnb> gnb> gnb> gnb> gnb>
gnb> ''' gnb> gnb> import albatross gnb> ctx = albatross.SimpleContext('.') gnb> albatross.Template(ctx, '', s).to_html(ctx) gnb> ctx.flush_content() gnb> gnb> Traceback (most recent call last): gnb> File "t.py", line 15, in ? gnb> albatross.Template(ctx, '', s).to_html(ctx) gnb> File "/usr/local/lib/python2.1/site-packages/albatross/template.py", line 283, in __init__ gnb> raise TemplateError('%s:%s: "%s"; unexpected "%s" end tag' \ gnb> albatross.template.TemplateError: :7: "/al-for"; unexpected "al-for" end tag gnb> gnb> I've stared and stared at this, and compared it to the popview gnb> example, and I'm stumped. I think the spaces around the '=' in the tags are causing the parser regexes to not recognise the tags. Things which are not recognised by the regex are treated as plain text. Try changing the template to this:
- Dave -- http://www.object-craft.com.au From andrewm at object-craft.com.au Fri Sep 13 17:09:21 2002 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 13 Sep 2002 17:09:21 +1000 Subject: [albatross-users] complete newbie al-for / template problem.... In-Reply-To: Message from Dave Cole of "13 Sep 2002 17:03:29 +1000." References: <200209130531.PAA05004@lightning.itga.com.au> Message-ID: <20020913070921.D8D3C3C9B1@coffee.object-craft.com.au> >I think the spaces around the '=' in the >tags are causing the parser regexes to not recognise the tags. Things >which are not recognised by the regex are treated as plain text. One other thing, I suspect you should be using f.value(), which is the flist element, rather than just plain "f", which is the iterator instance. >Try changing the template to this: > > > > > > > > > >
-- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From gnb at itga.com.au Fri Sep 13 17:41:19 2002 From: gnb at itga.com.au (Gregory Bond) Date: Fri, 13 Sep 2002 17:41:19 +1000 Subject: [albatross-users] complete newbie al-for / template problem.... In-Reply-To: Your message of 13 Sep 2002 17:03:29 +1000. Message-ID: <200209130741.RAA16435@lightning.itga.com.au> > I think the spaces around the '=' in the > tags are causing the parser regexes to not recognise the tags. That looks like it. It seems the template parser thinggy is much more limited than I might haver expected. (I don't remember reading anything that warned against this sort of thing, but perhaps this is assumed XML knowledge?) Some other ways I have tricked it: (note the bogus comma) (which seems reasonable from a python programmer's viewpoint!) These both gave an unhelpful message about " not expected". Also: (note the missing "" around the size arg) which caused the al-input tag to be passed through the template expansion verbatim, even tho this seems to work in raw HTML. Not bad for a couple of hours fiddling! So this comes to a suggestion: add a section to the manual to explain that the tag format is very picky and must be properly-formated XML. And a complete aside: has anyone looked at an Xemacs XML editing mode that knows the albatross tags? Greg. From andrewm at object-craft.com.au Fri Sep 13 19:39:49 2002 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 13 Sep 2002 19:39:49 +1000 Subject: [albatross-users] complete newbie al-for / template problem.... In-Reply-To: Message from Gregory Bond of "Fri, 13 Sep 2002 17:41:19 +1000." <200209130741.RAA16435@lightning.itga.com.au> References: <200209130741.RAA16435@lightning.itga.com.au> Message-ID: <20020913093949.556033C9B2@coffee.object-craft.com.au> >That looks like it. It seems the template parser thinggy is much more >limited than I might haver expected. (I don't remember reading anything >that warned against this sort of thing, but perhaps this is assumed XML >knowledge?) More likely we've just overlooked documenting it! 8-) The template parser is a huge regular expression - the downside is that it will overlook things that aren't correctly structured - the upside is that it will overlook everything but albatross tags (this is important for performance - if we used a real XML parser, we'd have to build an enourmous tree of every HTML tag, which, in python, would really bite). It also means that the user can be lazy in their pure-HTML mark-up without Albatross choking. >Some other ways I have tricked it: > (note the bogus comma) That's asking for it! 8-) > ( 1, 2, 3, # Lots and lots more > 4, 5, 6 > ) > '''> (which seems reasonable from a python programmer's viewpoint!) We could, in fact, relatively easily extend the parsing regexp to handle this. But an XML editor would probably choke (not that we're 100% correct with our XML at the moment - things like really should be (this does work)). >These both gave an unhelpful message about " not expected". Because the start tag wasn't recognised by the regexp. >Also: > > (note the missing "" around the size arg) >which caused the al-input tag to be passed through the template expansion >verbatim, even tho this seems to work in raw HTML. Yep - I suspect the regexp is again not seeing the attribute. XHTML explicitly disallows unquoted attributes. >Not bad for a couple of hours fiddling! Indeed - it's good having a fresh set of eyes over the code - you pick up many things that we miss. Keep the reports coming... 8-) >So this comes to a suggestion: add a section to the manual to explain that >the tag format is very picky and must be properly-formated XML. Good idea. >And a complete aside: has anyone looked at an Xemacs XML editing mode that >knows the albatross tags? That would be question for Dave, I think - he uses emacs more regularly than me. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From djc at object-craft.com.au Sun Sep 15 12:58:50 2002 From: djc at object-craft.com.au (Dave Cole) Date: 15 Sep 2002 12:58:50 +1000 Subject: [albatross-users] complete newbie al-for / template problem.... In-Reply-To: <20020913093949.556033C9B2@coffee.object-craft.com.au> References: <200209130741.RAA16435@lightning.itga.com.au> <20020913093949.556033C9B2@coffee.object-craft.com.au> Message-ID: >>>>> "Andrew" == Andrew McNamara writes: >> And a complete aside: has anyone looked at an Xemacs XML editing >> mode that knows the albatross tags? Andrew> That would be question for Dave, I think - he uses emacs more Andrew> regularly than me. I know enough elisp to make my .emacs work so an Albatross extension to any XML editing mode would be difficult. - Dave -- http://www.object-craft.com.au From bdhruva at gmx.net Mon Sep 16 07:52:15 2002 From: bdhruva at gmx.net (Dhruva B. Reddy) Date: Sun, 15 Sep 2002 15:52:15 -0600 Subject: [albatross-users] Uploading Files Message-ID: <20020915215215.GA8312@dr.mobizinc.com> I am trying to upload a file. From within my application, I can get the base file name, but I can't figure out where the file is stored on the server. Any help would be appreciated. Thanks, Dhruva -- "Advice is what we ask for when we already know the answer but wish we didn't." Erica Jong (b. 1942); US author From bdhruva at gmx.net Mon Sep 16 08:11:26 2002 From: bdhruva at gmx.net (Dhruva B. Reddy) Date: Sun, 15 Sep 2002 16:11:26 -0600 Subject: [albatross-users] Uploading Files...Pt II Message-ID: <20020915221126.GB8312@dr.mobizinc.com> Actually, I figured it out--I forgot that you have to set the ENCODE attribute in the HTML form. Sorry for the noise. -d -- "Advice is what we ask for when we already know the answer but wish we didn't." Erica Jong (b. 1942); US author From gnb at itga.com.au Mon Sep 16 15:43:09 2002 From: gnb at itga.com.au (Gregory Bond) Date: Mon, 16 Sep 2002 15:43:09 +1000 Subject: [albatross-users] Getting None in the __albform__? Message-ID: <200209160543.PAA17968@lightning.itga.com.au> The problem: I have a dict of IDs for which I need descriptions. (It's known as "missing" in the code below.) When I run the attached script (which is a cut down version of the original), it does the right thing (puts up the form etc), but when I hit Submit I get the following traceback: Template traceback (most recent call last): Traceback (most recent call last): File "/usr/local/lib/python2.1/site-packages/albatross/app.py", line 145, in run self.merge_request(ctx) File "/usr/local/lib/python2.1/site-packages/albatross/app.py", line 219, in merge_request ctx.merge_request() File "/usr/local/lib/python2.1/site-packages/albatross/context.py", line 294, in merge_request self.set_value(name, value) File "/usr/local/lib/python2.1/site-packages/albatross/context.py", line 321, in set_value elems = string.split(name, ',') File "/usr/local/lib/python2.1/string.py", line 114, in split return s.split(sep, maxsplit) AttributeError: 'None' object has no attribute 'split' Having a look at the generated HTML, and doing the unpickle trick on __albform__, I get the following: {'desc_id1': 0, 'desc_id2': 0, None: 0} Which is where I suspect the None in the traceback is coming from. Any clues? BTW: There orta be a neater way to run a template from a literal string, say a ctx.run_template_str() function, for quick 1-pagers like this! Greg, New set of eyes, new set of bugs! -------------- next part -------------- #! /usr/local/bin/python templ = ''' ''' import sys import albatross from albatross.cgiapp import Request class Input: def page_enter(self, ctx): ctx.locals.missing = { 'id1': '', 'id2': ''} ctx.locals.mkeys = ctx.locals.missing.keys() ctx.locals.mkeys.sort() def page_display(self, ctx): #ctx.run_template('input.html') t = albatross.Template(ctx,'', templ) t.to_html(ctx) def page_execute(self, ctx): print >> sys.stderr, "Never gets here" app = albatross.SimpleApp('t2.py', '.', 'input', 'secret') app.register_page('input', Input()) app.run(Request()) From andrewm at object-craft.com.au Mon Sep 16 15:48:52 2002 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Mon, 16 Sep 2002 15:48:52 +1000 Subject: [albatross-users] Getting None in the __albform__? In-Reply-To: Message from Gregory Bond of "Mon, 16 Sep 2002 15:43:09 +1000." <200209160543.PAA17968@lightning.itga.com.au> References: <200209160543.PAA17968@lightning.itga.com.au> Message-ID: <20020916054852.47E013C8FF@coffee.object-craft.com.au> >Having a look at the generated HTML, and doing the unpickle trick on >__albform__, I get the following: > > {'desc_id1': 0, 'desc_id2': 0, None: 0} > >Which is where I suspect the None in the traceback is coming from. My guess would be this: There's no name attribute there. Okay, Albatross should raise an exception earlier in the process... 8-) -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From gnb at itga.com.au Mon Sep 16 16:17:26 2002 From: gnb at itga.com.au (Gregory Bond) Date: Mon, 16 Sep 2002 16:17:26 +1000 Subject: [albatross-users] Getting None in the __albform__? In-Reply-To: Your message of Mon, 16 Sep 2002 15:48:52 +1000. Message-ID: <200209160617.QAA20204@lightning.itga.com.au> > My guess would be this: > > > > There's no name attribute there. Okay, Albatross should raise an exception > earlier in the process... 8-) Bingo! Thanks! From bgg at object-craft.com.au Tue Sep 17 19:31:00 2002 From: bgg at object-craft.com.au (Ben Golding) Date: Tue, 17 Sep 2002 19:31:00 +1000 Subject: [albatross-users] Re: Install in a shell account In-Reply-To: <3D847CC8.21352.F7FE0D@localhost> Message-ID: <2D5B353C-CA20-11D6-9197-003065907038@object-craft.com.au> On Monday, Sep 16, 2002, at 02:27 Australia/Melbourne, Bill Bell wrote: > I'm just starting out with Albatross, and just returning to a variant > of Unix from an > absence of several years. > > Your documentation seems quite excellent. Since it mentions your wish > to receive > notifications of failures of the installation software I offer the > following (which you > have probably seen before). > > [wbell at vex.net:albatross-1.00] $ python setup.py install > running install > running build > running build_py > creating build > creating build/lib > creating build/lib/albatross > copying albatross/__init__.py -> build/lib/albatross > copying albatross/apacheapp.py -> build/lib/albatross > copying albatross/app.py -> build/lib/albatross > copying albatross/cgiapp.py -> build/lib/albatross > copying albatross/context.py -> build/lib/albatross > copying albatross/pidfile.py -> build/lib/albatross > copying albatross/randompage.py -> build/lib/albatross > copying albatross/session.py -> build/lib/albatross > copying albatross/sessionfile.py -> build/lib/albatross > copying albatross/simpleserver.py -> build/lib/albatross > copying albatross/tags.py -> build/lib/albatross > copying albatross/template.py -> build/lib/albatross > running build_scripts > creating build/scripts > copying and adjusting session-server/al-session-daemon -> build/scripts > running install_lib > creating /usr/lib/python2.1/site-packages/albatross > error: could not create '/usr/lib/python2.1/site-packages/albatross': > Permission > denied > > Best of luck with your product. I'm itching to get started using it. This looks like it's a simple permissions problem: you probably need to install albatross as root (or a user who has access to /usr/lib/python2.1/site-packages). Try that and you should have more success. BTW, the mailing list for albatross is "albatross-users at object-craft.com.au". Ben. From bill-bell at bill-bell.hamilton.on.ca Tue Sep 17 22:23:46 2002 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Tue, 17 Sep 2002 08:23:46 -0400 Subject: [albatross-users] Re: Install in a shell account In-Reply-To: <2D5B353C-CA20-11D6-9197-003065907038@object-craft.com.au> References: <3D847CC8.21352.F7FE0D@localhost> Message-ID: <3D86E692.23128.7FDDB5@localhost> Ben, I _really_ should have mentioned that I was doing this on Win2K (where constructions like "/usr/lib/python" haven't much meaning) :o). Bill On 17 Sep 2002 at 19:31, Ben Golding wrote: > > On Monday, Sep 16, 2002, at 02:27 Australia/Melbourne, Bill Bell > wrote: > > > I'm just starting out with Albatross, and just returning to a > > variant of Unix from an absence of several years. > > > > Your documentation seems quite excellent. Since it mentions your > > wish to receive notifications of failures of the installation > > software I offer the following (which you have probably seen > > before). > > > > [wbell at vex.net:albatross-1.00] $ python setup.py install > > running install > > running build > > running build_py > > creating build > > creating build/lib > > creating build/lib/albatross > > copying albatross/__init__.py -> build/lib/albatross > > copying albatross/apacheapp.py -> build/lib/albatross > > copying albatross/app.py -> build/lib/albatross > > copying albatross/cgiapp.py -> build/lib/albatross > > copying albatross/context.py -> build/lib/albatross > > copying albatross/pidfile.py -> build/lib/albatross > > copying albatross/randompage.py -> build/lib/albatross > > copying albatross/session.py -> build/lib/albatross > > copying albatross/sessionfile.py -> build/lib/albatross > > copying albatross/simpleserver.py -> build/lib/albatross > > copying albatross/tags.py -> build/lib/albatross > > copying albatross/template.py -> build/lib/albatross > > running build_scripts > > creating build/scripts > > copying and adjusting session-server/al-session-daemon -> > > build/scripts running install_lib creating > > /usr/lib/python2.1/site-packages/albatross error: could not create > > '/usr/lib/python2.1/site-packages/albatross': Permission > > denied > > > > Best of luck with your product. I'm itching to get started using it. > > This looks like it's a simple permissions problem: you probably need > to install albatross as root (or a user who has access to > /usr/lib/python2.1/site-packages). Try that and you should have more > success. > > BTW, the mailing list for albatross is > "albatross-users at object-craft.com.au". > > Ben. From neel at mediapulse.com Wed Sep 18 03:46:16 2002 From: neel at mediapulse.com (Michael C. Neel) Date: Tue, 17 Sep 2002 13:46:16 -0400 Subject: [albatross-users] Broken PDF Message-ID: Hi all, I'm trying to print the pdf documentation, and it breaks every time at page 3. This happens both from the pdf on the web site and one built with make pdf; and also breaks on both windows and linux. I'd print off the ps version, but I really don't want it in the booklet form since I don't have access to a duplex printer. Thanks, Mike -- Michael C. Neel There are only 10 types of people in the world; those who understand binary and those who don't. From bdhruva at gmx.net Wed Sep 18 06:17:53 2002 From: bdhruva at gmx.net (Dhruva B. Reddy) Date: Tue, 17 Sep 2002 14:17:53 -0600 Subject: [albatross-users] Defining an "error" page... Message-ID: <20020917201753.GA1764@dr.mobizinc.com> In JavaServer Pages (JSP), you have the ability to specify a page to which the user is forwarded if there is an unrecoverable error. This is commonly used to send the user to a page that says "There has been an error. Please call the site administrator." rather than expose the user to the raw Python error displays, such as: Template traceback (most recent call last): Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/albatross/app.py", line 146, in run self.process_request(ctx) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 296, in process_request func(ctx) File "prop_list.py", line 25, in page_process aContext.set_page(page) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 86, in set_page self.app.load_page(self) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 253, in load_page self.load_page_module(ctx, name) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 268, in load_page_module file, filepath, desc = imp.find_module(name, [dirname]) ImportError: No module named bob Is there any way to achieve the same functionality in Albatross? Thanks, Dhruva -- "Advice is what we ask for when we already know the answer but wish we didn't." Erica Jong (b. 1942); US author From tchur at optushome.com.au Wed Sep 18 06:37:42 2002 From: tchur at optushome.com.au (Tim Churches) Date: Wed, 18 Sep 2002 06:37:42 +1000 Subject: [albatross-users] Broken PDF References: Message-ID: <3D879296.EF2DC670@optushome.com.au> "Michael C. Neel" wrote: > > Hi all, > > I'm trying to print the pdf documentation, and it breaks every > time at page 3. This happens both from the pdf on the web site and one > built with make pdf; and also breaks on both windows and linux. I'd > print off the ps version, but I really don't want it in the booklet form > since I don't have access to a duplex printer. This is a known bug - the PDFs generated from the LaTex2 source viathe Python macros cause Adobe Acrobat Version 5 to fall over whne printing. I think the PDF prints OK from Acrobat version 4. Not sure about GhostView etc. We worked around this problem for another project by converting the PostScript to a PDF using the commercial Acrobat Distiller. I am happy to do this for you, guys, if you e-mail me the PostScript at work. Tim C > > Thanks, > Mike > > -- > Michael C. Neel > There are only 10 types of people in the world; > those who understand binary and those who don't. > _______________________________________________ > Albatross-users mailing list > Albatross-users at object-craft.com.au > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users From neel at mediapulse.com Wed Sep 18 07:14:46 2002 From: neel at mediapulse.com (Michael C. Neel) Date: Tue, 17 Sep 2002 17:14:46 -0400 Subject: [albatross-users] Broken PDF Message-ID: Thanks, I guess I'll have to track down reader v4. I have converted the ps to pdf, but the ps is not in the same format as the pdf it is in a booklet form and I'd rather have it in normal form. Mike -----Original Message----- From: Tim Churches [mailto:tchur at optushome.com.au] Sent: Tuesday, September 17, 2002 4:38 PM To: Michael C. Neel Cc: albatross-users at object-craft.com.au Subject: Re: [albatross-users] Broken PDF "Michael C. Neel" wrote: > > Hi all, > > I'm trying to print the pdf documentation, and it breaks every > time at page 3. This happens both from the pdf on the web site and one > built with make pdf; and also breaks on both windows and linux. I'd > print off the ps version, but I really don't want it in the booklet form > since I don't have access to a duplex printer. This is a known bug - the PDFs generated from the LaTex2 source viathe Python macros cause Adobe Acrobat Version 5 to fall over whne printing. I think the PDF prints OK from Acrobat version 4. Not sure about GhostView etc. We worked around this problem for another project by converting the PostScript to a PDF using the commercial Acrobat Distiller. I am happy to do this for you, guys, if you e-mail me the PostScript at work. Tim C > > Thanks, > Mike > > -- > Michael C. Neel > There are only 10 types of people in the world; > those who understand binary and those who don't. > _______________________________________________ > Albatross-users mailing list > Albatross-users at object-craft.com.au > https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users From andrewm at object-craft.com.au Wed Sep 18 10:31:29 2002 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 18 Sep 2002 10:31:29 +1000 Subject: [albatross-users] Defining an "error" page... In-Reply-To: Message from "Dhruva B. Reddy" of "Tue, 17 Sep 2002 14:17:53 CST." <20020917201753.GA1764@dr.mobizinc.com> References: <20020917201753.GA1764@dr.mobizinc.com> Message-ID: <20020918003129.C46133C8FF@coffee.object-craft.com.au> >In JavaServer Pages (JSP), you have the ability to specify a page to >which the user is forwarded if there is an unrecoverable error. This is >commonly used to send the user to a page that says "There has been an >error. Please call the site administrator." rather than expose the user >to the raw Python error displays, such as: [...] >Is there any way to achieve the same functionality in Albatross? Yes - the handle_exception() method on the Application mixin attempts to run the template "traceback.html", and only if that fails (doesn't exist, or produces an exception) does it display the traceback to the user. The python and template tracebacks are available to the template in python_exc and html_exc respectively. Alternatively, if you want to do something this framework doesn't allow, you can define you own handle_exception() method on your application class. Albatross tries to make it's source accessible for extension - have a look at the Application class in app.py to see how this machinery works. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From andrewm at object-craft.com.au Wed Sep 18 10:35:57 2002 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 18 Sep 2002 10:35:57 +1000 Subject: [albatross-users] Re: Install in a shell account In-Reply-To: Message from "Bill Bell" of "Tue, 17 Sep 2002 08:23:46 -0400." <3D86E692.23128.7FDDB5@localhost> References: <3D847CC8.21352.F7FE0D@localhost> <3D86E692.23128.7FDDB5@localhost> Message-ID: <20020918003557.211EF3C8FF@coffee.object-craft.com.au> >I _really_ should have mentioned that I was doing this on Win2K (where >constructions like "/usr/lib/python" haven't much meaning) :o). Have you tried doing the install from an account with administrator privileges? -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From djc at object-craft.com.au Wed Sep 18 10:38:07 2002 From: djc at object-craft.com.au (Dave Cole) Date: 18 Sep 2002 10:38:07 +1000 Subject: [albatross-users] Defining an "error" page... In-Reply-To: <20020917201753.GA1764@dr.mobizinc.com> References: <20020917201753.GA1764@dr.mobizinc.com> Message-ID: > In JavaServer Pages (JSP), you have the ability to specify a page to > which the user is forwarded if there is an unrecoverable error. This is > commonly used to send the user to a page that says "There has been an > error. Please call the site administrator." rather than expose the user > to the raw Python error displays, such as: > > Template traceback (most recent call last): > > Traceback (most recent call last): > File "/usr/lib/python2.1/site-packages/albatross/app.py", line 146, in run > self.process_request(ctx) > File "/usr/lib/python2.1/site-packages/albatross/app.py", line 296, in process_request func(ctx) > File "prop_list.py", line 25, in page_process > aContext.set_page(page) > File "/usr/lib/python2.1/site-packages/albatross/app.py", line 86, in set_page > self.app.load_page(self) > File "/usr/lib/python2.1/site-packages/albatross/app.py", line 253, in load_page > self.load_page_module(ctx, name) > File "/usr/lib/python2.1/site-packages/albatross/app.py", line 268, in load_page_module > file, filepath, desc = imp.find_module(name, [dirname]) > ImportError: No module named bob > > > Is there any way to achieve the same functionality in Albatross? If you look in app.py at the handle_exception() method of the Application class you will see how it performs the exception reporting you are seeing. All Albatross application classes inherit from Application. You have two options for changing what you see: 1) Provide a template file called traceback.html which contains the text you want the user to see. 2) Subclass the Albatross application object and override the handle_exception() method. You could make your version report the traceback to a log file, send email, whatever takes your fancy. - Dave -- http://www.object-craft.com.au From bill-bell at bill-bell.hamilton.on.ca Wed Sep 18 10:53:53 2002 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Tue, 17 Sep 2002 20:53:53 -0400 Subject: [albatross-users] Re: Install in a shell account In-Reply-To: <20020918003557.211EF3C8FF@coffee.object-craft.com.au> References: Message from "Bill Bell" of "Tue, 17 Sep 2002 08:23:46 -0400." <3D86E692.23128.7FDDB5@localhost> Message-ID: <3D879661.27918.32EA0C1@localhost> Andrew, thanks for responding. Yes, I've been using an administrator's login. I changed install.cfg since reporting my problem. It now contains the following line. cgibin_dir = "H:/Program Files/Apache Group/Apache/cgi-bin/albatross" and these installs work just fine. It's entirely possible that I did something incorrectly during the installation of albatross as a whole, and that this resulted in the cgibin_dir being set to something suitable for a Unix-style system. Just thought you might like to know what my experience was. Cheers, Bill On 18 Sep 2002 at 10:35, Andrew McNamara wrote: > >I _really_ should have mentioned that I was doing this on Win2K > >(where constructions like "/usr/lib/python" haven't much meaning) > >:o). > > Have you tried doing the install from an account with administrator > privileges? > > -- > Andrew McNamara, Senior Developer, Object Craft > http://www.object-craft.com.au/ From andrewm at object-craft.com.au Wed Sep 18 11:15:38 2002 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 18 Sep 2002 11:15:38 +1000 Subject: [albatross-users] Re: Install in a shell account In-Reply-To: Message from "Bill Bell" of "Tue, 17 Sep 2002 20:53:53 -0400." <3D879661.27918.32EA0C1@localhost> References: Message from "Bill Bell" of "Tue, 17 Sep 2002 08:23:46 -0400." <3D86E692.23128.7FDDB5@localhost> <3D879661.27918.32EA0C1@localhost> Message-ID: <20020918011538.0F7E43C21B@coffee.object-craft.com.au> >Andrew, thanks for responding. Yes, I've been using an administrator's login. > >I changed install.cfg since reporting my problem. It now contains the >following line. > >cgibin_dir = "H:/Program Files/Apache Group/Apache/cgi-bin/albatross" > >and these installs work just fine. Is this a different problem, though? The original failure appeared to occur while installing albatross itself, but this sounds more like a problem with the sample installer (it prompts the user to supply install paths the first time around, then saves them to install.cfg)? >It's entirely possible that I did something incorrectly during the >installation of albatross as a whole, and that this resulted in the >cgibin_dir being set to something suitable for a Unix-style system. If it was the samples installer, it does prompt, but the default is set to the Debian-centric /usr/lib/cgi-bin... >Just thought you might like to know what my experience was. Yes indeed - all feedback is appreciated. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From bill-bell at bill-bell.hamilton.on.ca Thu Sep 19 01:48:50 2002 From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell) Date: Wed, 18 Sep 2002 11:48:50 -0400 Subject: [albatross-users] Re: Install in a shell account In-Reply-To: <20020918011538.0F7E43C21B@coffee.object-craft.com.au> References: Message from "Bill Bell" of "Tue, 17 Sep 2002 20:53:53 -0400." <3D879661.27918.32EA0C1@localhost> Message-ID: <3D886822.26469.13E67EF@localhost> Andrew, my apologies for not being more lucid in the first place. I was assuming you'd seen this more often. - Bill On 18 Sep 2002 at 11:15, Andrew McNamara wrote: > >Andrew, thanks for responding. Yes, I've been using an > >administrator's login. > > > >I changed install.cfg since reporting my problem. It now contains the > >following line. > > > >cgibin_dir = "H:/Program Files/Apache Group/Apache/cgi-bin/albatross" > > > >and these installs work just fine. > > Is this a different problem, though? The original failure appeared to > occur while installing albatross itself, but this sounds more like a > problem with the sample installer (it prompts the user to supply > install paths the first time around, then saves them to install.cfg)? > > >It's entirely possible that I did something incorrectly during the > >installation of albatross as a whole, and that this resulted in the > >cgibin_dir being set to something suitable for a Unix-style system. > > If it was the samples installer, it does prompt, but the default is > set to the Debian-centric /usr/lib/cgi-bin... > > >Just thought you might like to know what my experience was. > > Yes indeed - all feedback is appreciated. > > -- > Andrew McNamara, Senior Developer, Object Craft > http://www.object-craft.com.au/ From bdhruva at gmx.net Fri Sep 20 04:52:04 2002 From: bdhruva at gmx.net (Dhruva B. Reddy) Date: Thu, 19 Sep 2002 12:52:04 -0600 Subject: [albatross-users] Questions Message-ID: <20020919185204.GA889@dr.mobizinc.com> We are building an application that will process image files (JPGs, GIFs, etc.) uploaded by the user. 1) How do we get to the Content-Type to figure out the content type of the uploaded file 2) How do we get to the file name that the user specified? 3) How do we limit the memory used during a binary file upload and provide a way to gracefully inform the user that they have exceeded this size and must therefore upload a file with less number of bytes? Thanks, Dhruva -- "Advice is what we ask for when we already know the answer but wish we didn't." Erica Jong (b. 1942); US author From djc at object-craft.com.au Sat Sep 21 23:07:05 2002 From: djc at object-craft.com.au (Dave Cole) Date: 21 Sep 2002 23:07:05 +1000 Subject: [albatross-users] Questions In-Reply-To: <20020919185204.GA889@dr.mobizinc.com> References: <20020919185204.GA889@dr.mobizinc.com> Message-ID: > We are building an application that will process image files (JPGs, > GIFs, etc.) uploaded by the user. > > 1) How do we get to the Content-Type to figure out the content type of > the uploaded file ctx.request.get_header('Content-Type') > 2) How do we get to the file name that the user specified? To handle file uploading you will need to make a slight change to the Request class to detect when a field is of type file and return something other then a plain value. For example in cgiapp.Request.field_value() you would need to do something like this: def field_value(self, name): field = self.__fields[name] if type(field) is type([]): value = [] for elem in field: value.append(elem.value) return value + if hasattr(field, 'filename'): + return field return field.value This would just return the raw request field which you handle as per normal cgi file upload. Retro-fitting file upload to apacheapp.Request would require something similar. > 3) How do we limit the memory used during a binary file upload and > provide a way to gracefully inform the user that they have exceeded > this size and must therefore upload a file with less number of bytes? The standard Python cgi module does not read the entire file into memory - it reads and writes 8k at a time. The mod_python module seems to read everything as text. The Python cgi module has a maxlen variable which you can set to your maximum file size. At some stage we will have to implement file upload capability for Albatross. - Dave -- http://www.object-craft.com.au
IDDescription