From abulka at netspace.net.au Fri Mar 14 10:05:21 2003 From: abulka at netspace.net.au (abulka at netspace.net.au) Date: Fri, 14 Mar 2003 10:05:21 +1100 Subject: [albatross-users] file upload capability for Albatross Message-ID: <1047596721.3e710eb1767d8@webmail.netspace.net.au> Hi Dave, I like Albatross more and more... On 21 Sep 2002 you wrote: "At some stage we will have to implement file upload capability for Albatross." Any idea when a new release with this capability will happen? I want my users to upload text and images onto a single web page, and have that same web page appear immediately with the new images/comments - like a wikki. Also hoping to avoid cache problems so that the new page is presented straight away. Should I make the change to a cgiapp.Request.field_value() as you recommended in an earlier post - and just go with that? Would a new albatross release do any more for me? thanks for any thoughts, -Andy Bulka http://www.atug.com/andypatterns ------------------------------------------------------------ This email was sent from Netspace Webmail: http://www.netspace.net.au From andrewm at object-craft.com.au Fri Mar 14 10:43:59 2003 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 14 Mar 2003 10:43:59 +1100 Subject: [albatross-users] file upload capability for Albatross In-Reply-To: Message from abulka@netspace.net.au of "Fri, 14 Mar 2003 10:05:21 +1100." <1047596721.3e710eb1767d8@webmail.netspace.net.au> References: <1047596721.3e710eb1767d8@webmail.netspace.net.au> Message-ID: <20030313234359.572893CC5F@coffee.object-craft.com.au> > "At some stage we will have to implement file upload capability for > Albatross." > > Any idea when a new release with this capability will happen? We needed this recently ourselves - this is one of the changes that is waiting for us to get off our butt and release a new albatross. Note to self - need to add example type="file" use to doco. The changelog entry reads: Added support for . For inputs of this sort, the local context now gets a list of FileField instances. The FileField class contains attributes for filename (filename), open file object (file), and mime type (type). The NameRecorder Mixin tracks whether a type="file" input has been seen, and the to_html method of the Form class generates the appropriate enctype attribute if seen (otherwise file inputs simply pass back the filename). On type="file" inputs, "value" attributes are now ignored. Currently this is only supported on the cgiapp request class, and no documentation or tests have been written. > Should I make the change to a cgiapp.Request.field_value() as you recommended >in an earlier post - and just go with that? Would a new albatross release do >any more for me? The changes were recently involved, and I'm sure the diff won't apply cleanly to the 1.01 release. For information purposes only (you probably don't want to try to apply it unless you're really desperate): cvs server: Diffing . Index: cgiapp.py =================================================================== RCS file: /usr/local/cvsroot/object-craft/albatross/albatross/cgiapp.py,v retrieving revision 1.28 retrieving revision 1.30 diff -u -r1.28 -r1.30 --- cgiapp.py 29 Nov 2002 10:12:47 -0000 1.28 +++ cgiapp.py 11 Dec 2002 05:08:00 -0000 1.30 @@ -5,9 +5,21 @@ # import cgi, sys, os, string +class FileField: + def __init__(self, field): + self.filename = field.filename + self.file = field.file + self.type = field.type + + def __repr__(self): + return 'FileField(%s, %s, %s)' % (self.filename, self.file, self.type) + class Request: - def __init__(self): - self.__fields = cgi.FieldStorage() + def __init__(self, fields = None): + if fields: + self.__fields = fields + else: + self.__fields = cgi.FieldStorage() self.__sent_headers = 0 self.__status = 200 @@ -16,12 +28,18 @@ 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 isinstance(field, type([])): + return map(lambda f: f.value, field) return field.value + + def field_file(self, name): + field = self.__fields[name] + if isinstance(field, type([])): + return map(FileField, field) + if field.type[:9] == 'multipart': + return map(FileField, field.value) + else: + return [FileField(field)] def field_names(self): return self.__fields.keys() Index: context.py =================================================================== RCS file: /usr/local/cvsroot/object-craft/albatross/albatross/context.py,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- context.py 6 Dec 2002 07:06:34 -0000 1.72 +++ context.py 11 Dec 2002 04:10:48 -0000 1.73 @@ -229,11 +229,14 @@ return '(%s,%s)' % (self.x, self.y) class NameRecorderMixin: + NORMAL, LIST, FILE = range(3) + def __init__(self): self.__elem_names = {} def form_open(self): self.__elem_names = {} + self.__need_multipart_enc = 0 def form_close(self): text = cPickle.dumps(self.__elem_names, 1) @@ -245,9 +248,13 @@ self.write_content(text) self.write_content('">\n') self.__elem_names = {} + return self.__need_multipart_enc def input_add(self, itype, name, unused_value = None, return_list = 0): - if self.__elem_names.has_key(name): + if itype == 'file': + self.__need_multipart_enc = 1 + self.__elem_names[name] = self.FILE + elif self.__elem_names.has_key(name): prev_multiples = self.__elem_names[name] implicit_multi = itype in ('radio', 'submit', 'image') if not return_list and not implicit_multi: @@ -261,7 +268,10 @@ raise FieldTypeError('"%s" initially defined as "list"' % \ name) else: - self.__elem_names[name] = return_list + if return_list: + self.__elem_names[name] = self.LIST + else: + self.__elem_names[name] = self.NORMAL def merge_request(self): if not self.request.has_field('__albform__'): @@ -277,8 +287,10 @@ if not text: return elem_names = cPickle.loads(text) - for name, return_list in elem_names.items(): - if self.request.has_field(name): + for name, mode in elem_names.items(): + if mode == self.FILE: + value = self.request.field_file(name) + elif self.request.has_field(name): value = self.request.field_value(name) else: x_name = '%s.x' % name @@ -289,7 +301,7 @@ int(self.request.field_value(y_name))) else: value = None - if return_list: + if mode == self.LIST: if not value: value = [] elif type(value) is not type([]): Index: tags.py =================================================================== RCS file: /usr/local/cvsroot/object-craft/albatross/albatross/tags.py,v retrieving revision 1.100 retrieving revision 1.102 diff -u -r1.100 -r1.102 --- tags.py 18 Nov 2002 23:18:39 -0000 1.100 +++ tags.py 11 Dec 2002 04:10:48 -0000 1.102 @@ -149,18 +149,18 @@ ctx.write_content(' checked') ctx.input_add('checkbox', name, value_attr, self.has_attrib('list')) - def image_to_html(self, ctx): + def generic_novalue_to_html(self, ctx): # value= not applicable - self.write_attribs_except(ctx) + self.write_attribs_except(ctx, 'value') name = self.get_name(ctx) ctx.write_content(' name="%s"' % name) - ctx.input_add('image', name, None, self.has_attrib('list')) + ctx.input_add(self.__itype, name, None, self.has_attrib('list')) type_dict = { 'text': generic_to_html, 'password': generic_to_html, 'radio': radio_to_html, 'checkbox': checkbox_to_html, 'submit': generic_to_html, 'reset': generic_to_html, - 'image': image_to_html, 'file': generic_to_html, + 'image': generic_novalue_to_html, 'file': generic_novalue_to_html, 'hidden': generic_to_html, 'button': generic_to_html, } # Allows the application need to modify the HREF attribute of the @@ -229,18 +229,27 @@ # Using the albatross
tag allows Albatross to record the # contents of each form. This is used to register valid browser # requests with the toolkit. +# +# We use a content_trap to capture the enclosed content so we know before +# emiting the element whether or not to use a multipart/form-data +# encoding (required to make work correctly). class Form(EnclosingTag): name = 'al-form' def to_html(self, ctx): + ctx.push_content_trap() + ctx.form_open() + EnclosingTag.to_html(self, ctx) + use_multipart_enc = ctx.form_close() + content = ctx.pop_content_trap() ctx.write_content('') - ctx.form_open() - EnclosingTag.to_html(self, ctx) - ctx.form_close() + ctx.write_content(content) ctx.write_content('') # Applications which need to know the list of valid @@ -250,6 +259,10 @@ # Two forms implemented: # 12 # Arbitrary text +# +# In the first form, we need to evaluate the content of the tag before +# we output the start tag so we can determine whether or not to set +# the selected attribute on the option, hence the use of the content_trap. class Option(EnclosingTag): name = 'al-option' -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From andrewm at object-craft.com.au Fri Mar 14 11:04:35 2003 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 14 Mar 2003 11:04:35 +1100 Subject: [albatross-users] file upload capability for Albatross In-Reply-To: Message from Andrew McNamara of "Fri, 14 Mar 2003 10:43:59 +1100." <20030313234359.572893CC5F@coffee.object-craft.com.au> References: <1047596721.3e710eb1767d8@webmail.netspace.net.au> <20030313234359.572893CC5F@coffee.object-craft.com.au> Message-ID: <20030314000435.573873CC5F@coffee.object-craft.com.au> >The changes were recently involved, and I'm sure the diff won't apply That should have been "were reasonably involved" - my fingers were off doing their own thing again. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From abulka at netspace.net.au Mon Mar 17 15:30:14 2003 From: abulka at netspace.net.au (abulka at netspace.net.au) Date: Mon, 17 Mar 2003 15:30:14 +1100 Subject: [albatross-users] URL style user inputs requiring a session server Message-ID: <1047875414.3e754f56d70d3@webmail.netspace.net.au> I'm having trouble running the popview3 example. 1. I copied the file session-server/simpleserver.py into the popview3 directory, ran it and then entered http://localhost:34343/popview.py into my browser. This doesn't work - what are the correct instructions for running the popview3 example? 2. It seems that in order to have an albatross app be responsive to URL style user inputs, like popview3, e.g.
Next Page then one needs to run an albatross session server. Doesn't this mean that I cannot deploy on my regular obscure overseas ISP since they won't let me run my own server, let alone have my own port? 3. Is there any documentation or quick overview of what each part of URL style user inputs, mean to albatross? e.g. e.g. Next Page What exact bit of my web app code is executed when a user clicks on such an url? How do I get at the url parameters or does albatross make them available for me in some way? If I had popview3 running I could probably deconstruct it and figure out my question #3, however some simple documentation on this would be good. The doco on tags is great on creating these sorts of tags, but not on what they mean. thanks, -Andy Bulka http://www.atug.com/andypatterns ------------------------------------------------------------ This email was sent from Netspace Webmail: http://www.netspace.net.au From andrewm at object-craft.com.au Wed Mar 19 12:19:03 2003 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 19 Mar 2003 12:19:03 +1100 Subject: [albatross-users] URL style user inputs requiring a session server In-Reply-To: Message from abulka@netspace.net.au of "Mon, 17 Mar 2003 15:30:14 +1100." <1047875414.3e754f56d70d3@webmail.netspace.net.au> References: <1047875414.3e754f56d70d3@webmail.netspace.net.au> Message-ID: <20030319011903.9D7433CC5F@coffee.object-craft.com.au> >1. I copied the file session-server/simpleserver.py >into the popview3 directory, ran it and then entered > http://localhost:34343/popview.py >into my browser. This doesn't work - what are the >correct instructions for running the popview3 example? The session server is a helper for the cgi, rather than being something users access directly (the albatross application still runs under your web server). You the session server with something like: al-session-daemon -l /tmp/al-ses.log -k /tmp/al-ses.pid start You can also give it a -h option, and it will show you other arguments that it accepts. Once it is running, you should be able to use session-server based albatross applications. Assuming that you had installed the popview3 sample to your web server's cgi-bin directory, you would access it as: http://localhost/cgi-bin/popview3/popview.py >2. It seems that in order to have an albatross app be >responsive to URL style user inputs, like popview3, >e.g. Next Page then >one needs to run an albatross session server. Doesn't >this mean that I cannot deploy on my regular obscure >overseas ISP since they won't let me run my own server, >let alone have my own port? You may find the session-file mixin more suitable in this case - it uses files (by default in /tmp/) to record the session, rather than passing the session to the session server. >3. Is there any documentation or quick overview of >what each part of URL style user inputs, mean to >albatross? e.g. > e.g. Next Page >What exact bit of my web app code is executed when a user >clicks on such an url? How do I get at the url parameters >or does albatross make them available for me in some way? This is a special signal to the al-for iterator called "m", and isn't passed directly to your application. Normally the al-for statement iterates over all elements of the supplied list, but if you specify the pagesize attribute, it will render the supplied list the specified number of elements at a time, and the nextpage/prevpage stuff is used to give the user control over which pagesized chunk of the list will be rendered. >If I had popview3 running I could probably deconstruct it >and figure out my question #3, however some simple >documentation on this would be good. The doco on tags >is great on creating these sorts of tags, but not on what >they mean. Hope this helps. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From neel at mediapulse.com Thu Mar 20 02:43:22 2003 From: neel at mediapulse.com (Michael C. Neel) Date: Wed, 19 Mar 2003 10:43:22 -0500 Subject: [albatross-users] URL style user inputs requiring a session server Message-ID: I'm not sure if this will help, but I'm messed around with CSS to create a sumbit button to look like a hyperlink, so that I can have a link submit a form (without resorting to javascript), and allow me to keep the session in the hidden fields. Mike .btn { font-family: Arial, Helvetica, sans-serif; font-size: 18px; color: #000000; border-style: none; background-color: #FFFFFF; text-decoration: underline; cursor: hand; } -----Original Message----- From: abulka at netspace.net.au [mailto:abulka at netspace.net.au] Sent: Sunday, March 16, 2003 11:30 PM To: albatross-users at object-craft.com.au Subject: [albatross-users] URL style user inputs requiring a session server I'm having trouble running the popview3 example. 1. I copied the file session-server/simpleserver.py into the popview3 directory, ran it and then entered http://localhost:34343/popview.py into my browser. This doesn't work - what are the correct instructions for running the popview3 example? 2. It seems that in order to have an albatross app be responsive to URL style user inputs, like popview3, e.g. Next Page then one needs to run an albatross session server. Doesn't this mean that I cannot deploy on my regular obscure overseas ISP since they won't let me run my own server, let alone have my own port? 3. Is there any documentation or quick overview of what each part of URL style user inputs, mean to albatross? e.g. e.g. Next Page What exact bit of my web app code is executed when a user clicks on such an url? How do I get at the url parameters or does albatross make them available for me in some way? If I had popview3 running I could probably deconstruct it and figure out my question #3, however some simple documentation on this would be good. The doco on tags is great on creating these sorts of tags, but not on what they mean. thanks, -Andy Bulka http://www.atug.com/andypatterns ------------------------------------------------------------ This email was sent from Netspace Webmail: http://www.netspace.net.au _______________________________________________ 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 Mar 26 09:58:38 2003 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Wed, 26 Mar 2003 09:58:38 +1100 Subject: [albatross-users] URL style user inputs requiring a session server In-Reply-To: Message from "Michael C. Neel" of "Wed, 19 Mar 2003 10:43:22 CDT." References: Message-ID: <20030325225838.E4E743C6F7@coffee.object-craft.com.au> >I'm not sure if this will help, but I'm messed around with CSS to create >a sumbit button to look like a hyperlink, so that I can have a link >submit a form (without resorting to javascript), and allow me to keep >the session in the hidden fields. > >Mike > >.btn {=20 > font-family: Arial, Helvetica, sans-serif; > font-size: 18px; color: #000000; > border-style: none; > background-color: #FFFFFF; > text-decoration: underline; > cursor: hand; >} I couldn't get this to work when I tried it yesterday (with Opera and Mozilla as browsers) - in particular, I can't see anything in the style that would trigger the rendering of the button as a link. For the markup, I was using something like: -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From neel at mediapulse.com Thu Mar 27 04:02:56 2003 From: neel at mediapulse.com (Michael C. Neel) Date: Wed, 26 Mar 2003 12:02:56 -0500 Subject: [albatross-users] URL style user inputs requiring a session server Message-ID: I take it you are using linux browsers? I haven't really checked the style sheet there, as I'm mostly concerned with Windows systems. In the case where I've used this was on an Intranet, and it was IE only so cross-platform wasn't an issue. Try it in IE to make sure you have it working (I'd just use a standard to rule out an albatross issues), then you can see if those browsers support enough css to make this work. Mike -----Original Message----- From: Andrew McNamara [mailto:andrewm at object-craft.com.au] Sent: Tuesday, March 25, 2003 5:59 PM To: Michael C. Neel Cc: albatross-users at object-craft.com.au Subject: Re: [albatross-users] URL style user inputs requiring a session server >I'm not sure if this will help, but I'm messed around with CSS to >create a sumbit button to look like a hyperlink, so that I can have a >link submit a form (without resorting to javascript), and allow me to >keep the session in the hidden fields. > >Mike > >.btn {=20 > font-family: Arial, Helvetica, sans-serif; > font-size: 18px; color: #000000; > border-style: none; > background-color: #FFFFFF; > text-decoration: underline; > cursor: hand; >} I couldn't get this to work when I tried it yesterday (with Opera and Mozilla as browsers) - in particular, I can't see anything in the style that would trigger the rendering of the button as a link. For the markup, I was using something like: -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From francis.meyvis at sonycom.com Thu Mar 27 22:59:33 2003 From: francis.meyvis at sonycom.com (Francis Meyvis) Date: Thu, 27 Mar 2003 12:59:33 +0100 Subject: [albatross-users] problem with static data members in templates ... Message-ID: <3E82E7A5.2080806@sonycom.com> Hoi, In a HTML form I present a database record/row data for editing. The class cRow abstacts the db data. The class in a simplified form is presented next: class cRow(): mFld = cField("table_name") def __init__(s, atData): mlData = list(atData) # convert db query result tuple to list def __getitem__(s, i): return mlData[i] def __setitem__(s, i, v): mlData[i] = v def validate(): ... # validate the data in mlData def update(): ... # update database with changed mlData cField is a static datamember to conserve memory (it is the same for all rows of that specific table). cField uses the DB API II ".description" to query the table format. Using this information it adds datamembers to itself during __init__() e.g. mFld.mVal.NAME evaluates to a numberic index for indexing the list "mlData" to find the value corresponding to the column named 'NAME' In the template I do something like this: The idea was :-( that "row" is found in context.locals. The advantage I saw, was that row's mlData is read and write by albatross templating mechanism. No need for me to start adding accessor functions. But is does not work, I get the trace dump error below (I use slight different variable names). This could be a python 2.1 limitation however. When I do a "dir(row)" I only see row's normal data members. Not the static data member mFld. In my python code (not template) itself this mechanism for manipulating db data through cRow works. Does someone on the list has a simple solution? Many thanks, francis Template traceback (most recent call last): File "tmpl/prjAdd.html", line 34, in al-form File "tmpl/prjAdd.html", line 40, in al-input Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/albatross/app.py", line 147, in run self.display_response(ctx) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 305, in display_response func(ctx) File "page/prjAdd.py", line 58, in page_display aoCtx.run_template(mode.GetTmplName(aoCtx)) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 65, in run_template templ.to_html(self) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 358, in to_html self.content.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 150, in to_html item.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 242, in to_html EnclosingTag.to_html(self, ctx) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 189, in to_html self.content.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 150, in to_html item.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 117, in to_html self.unbound_to_html(self, ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 122, in generic_to_html name, value = self.get_name_and_value(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 90, in get_name_and_value return name, self.eval_expr(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 36, in eval_expr return ctx.eval_expr(self.expr) File "/usr/lib/python2.1/site-packages/albatross/context.py", line 320, in eval_expr return eval(expr, self.__globals, self.locals.__dict__) File "", line 0, in ? AttributeError: mFld From francis.meyvis at sonycom.com Fri Mar 28 01:51:03 2003 From: francis.meyvis at sonycom.com (Francis Meyvis) Date: Thu, 27 Mar 2003 15:51:03 +0100 Subject: [albatross-users] [Fwd: problem with static data members in templates ...] Message-ID: <3E830FD7.3000803@sonycom.com> Hoi, Seems I made a scripting error that caused the error described in my previous email. However my problems with the idea are not gone. When the post request from the form arrives I get the error in context.py NamespaceMixin::set_value() described below. I patched the method by adding an exception catch in which I evaluate a statement "name = `value`". Is there a danger doing so? There's a big change someone can execute arbitrary code this way? try: original code except: vsStatement = name + "=" + `value` + "\n" exec vsStatement in self.locals.__dict__ Kind regards, francis Template traceback (most recent call last): Traceback (most recent call last): File "lib/albatross/app.py", line 145, in run self.merge_request(ctx) File "lib/albatross/app.py", line 219, in merge_request ctx.merge_request() File "lib/albatross/context.py", line 297, in merge_request self.set_value(name, value) File "lib/albatross/context.py", line 355, in set_value index = int(elem) ValueError: invalid literal for int(): prj -------- Original Message -------- Subject: problem with static data members in templates ... Date: Thu, 27 Mar 2003 12:59:33 +0100 From: Francis Meyvis To: albatross-users at object-craft.com.au Hoi, In a HTML form I present a database record/row data for editing. The class cRow abstacts the db data. The class in a simplified form is presented next: class cRow(): mFld = cField("table_name") def __init__(s, atData): mlData = list(atData) # convert db query result tuple to list def __getitem__(s, i): return mlData[i] def __setitem__(s, i, v): mlData[i] = v def validate(): ... # validate the data in mlData def update(): ... # update database with changed mlData cField is a static datamember to conserve memory (it is the same for all rows of that specific table). cField uses the DB API II ".description" to query the table format. Using this information it adds datamembers to itself during __init__() e.g. mFld.mVal.NAME evaluates to a numberic index for indexing the list "mlData" to find the value corresponding to the column named 'NAME' In the template I do something like this: The idea was :-( that "row" is found in context.locals. The advantage I saw, was that row's mlData is read and write by albatross templating mechanism. No need for me to start adding accessor functions. But is does not work, I get the trace dump error below (I use slight different variable names). This could be a python 2.1 limitation however. When I do a "dir(row)" I only see row's normal data members. Not the static data member mFld. In my python code (not template) itself this mechanism for manipulating db data through cRow works. Does someone on the list has a simple solution? Many thanks, francis Template traceback (most recent call last): File "tmpl/prjAdd.html", line 34, in al-form File "tmpl/prjAdd.html", line 40, in al-input Traceback (most recent call last): File "/usr/lib/python2.1/site-packages/albatross/app.py", line 147, in run self.display_response(ctx) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 305, in display_response func(ctx) File "page/prjAdd.py", line 58, in page_display aoCtx.run_template(mode.GetTmplName(aoCtx)) File "/usr/lib/python2.1/site-packages/albatross/app.py", line 65, in run_template templ.to_html(self) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 358, in to_html self.content.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 150, in to_html item.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 242, in to_html EnclosingTag.to_html(self, ctx) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 189, in to_html self.content.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/template.py", line 150, in to_html item.to_html(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 117, in to_html self.unbound_to_html(self, ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 122, in generic_to_html name, value = self.get_name_and_value(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 90, in get_name_and_value return name, self.eval_expr(ctx) File "/usr/lib/python2.1/site-packages/albatross/tags.py", line 36, in eval_expr return ctx.eval_expr(self.expr) File "/usr/lib/python2.1/site-packages/albatross/context.py", line 320, in eval_expr return eval(expr, self.__globals, self.locals.__dict__) File "", line 0, in ? AttributeError: mFld From djc at object-craft.com.au Fri Mar 28 09:23:58 2003 From: djc at object-craft.com.au (Dave Cole) Date: 28 Mar 2003 09:23:58 +1100 Subject: [albatross-users] [Fwd: problem with static data members in templates ...] In-Reply-To: <3E830FD7.3000803@sonycom.com> References: <3E830FD7.3000803@sonycom.com> Message-ID: > Seems I made a scripting error that caused the error described in my > previous email. > > However my problems with the idea are not gone. When the post > request from the form arrives I get the error in context.py > NamespaceMixin::set_value() described below. The parsing of input field names when merging requests is deliberately limited to the following: name ::= identifier | list-backdoor | tree-backdoor identifier ::= identifier (("." identifier) | ("[" number "]"))* list-backdoor ::= operation "," iter tree-backdoor ::= operation "," iter "," alias This is from the documentation: http://www.object-craft.com.au/projects/albatross/albatross/mixin-namespace.html You could probably replace the: With: This would make cause the template to generate input field with names like row[0], row[1], etc. The request merging will understand these input field names. - Dave -- http://www.object-craft.com.au