webtek-devel Mailing List for WebTek (Page 3)
Status: Alpha
Brought to you by:
prozessor13
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(3) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
(3) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(10) |
May
(32) |
Jun
(65) |
Jul
(31) |
Aug
(9) |
Sep
(15) |
Oct
(9) |
Nov
(24) |
Dec
(12) |
2009 |
Jan
(32) |
Feb
(4) |
Mar
(13) |
Apr
(28) |
May
(66) |
Jun
(76) |
Jul
(45) |
Aug
(24) |
Sep
(22) |
Oct
(30) |
Nov
(6) |
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
(39) |
Apr
(46) |
May
(61) |
Jun
(48) |
Jul
(38) |
Aug
(45) |
Sep
(20) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: max d. <pro...@gm...> - 2008-07-02 15:55:28
|
no.. no such mechanism is implemented (because i never run into this problem, although i alreay thouth about this problem ), but it should be very easy to implement it. if this problem is online in one page you can set the request-header in the corresponding action: sub index { ... response->header('Cache-Control' => 'no-cache'); response->header('Pragma' => 'no-cache'); } or do it system-wide: event->register( 'name' => 'request-prepare-end', 'method' => sub { response->header('Cache-Control' => 'no-cache'); response->header('Pragma' => 'no-cache'); } ); On 02.07.2008, at 17:40, Adrian Smith wrote: > Hi, > > What is the correct way to prevent the browser caching pages in > WebTek? > > I mean I am no expert about how to prevent caching in general - but > e.g. taking a look at another project, the following HTTP headers > are printed in the response: > > print "Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"; > print "Cache-Control: no-cache\n"; > print "Pragma: no-cache\n"; > > Is there any facility for these headers to automatically get added > to the response using the WebTek::Engine::ModPerl2 engine? > > My specific problem: User sees (in Internet Explorer) the login > screen (URL "/"). The user logs in. The user types URL "/" again > into the URL bar. The user sees the login screen again. > > Correct behaviour: A logged-in user navigates to "/" then a redirect > to the logged-in start page. Pressing Refresh in IE yields this > behaviour. On Firefox this works without having to press refresh. > > Thanks, Adrian > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08_______________________________________________ > Webtek-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webtek-devel |
From: Adrian S. <adr...@gm...> - 2008-07-02 15:40:16
|
Hi, What is the correct way to prevent the browser caching pages in WebTek? I mean I am no expert about how to prevent caching in general - but e.g. taking a look at another project, the following HTTP headers are printed in the response: print "Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"; print "Cache-Control: no-cache\n"; print "Pragma: no-cache\n"; Is there any facility for these headers to automatically get added to the response using the WebTek::Engine::ModPerl2 engine? My specific problem: User sees (in Internet Explorer) the login screen (URL "/"). The user logs in. The user types URL "/" again into the URL bar. The user sees the login screen again. Correct behaviour: A logged-in user navigates to "/" then a redirect to the logged-in start page. Pressing Refresh in IE yields this behaviour. On Firefox this works without having to press refresh. Thanks, Adrian |
From: Adrian S. <adr...@gm...> - 2008-07-01 12:51:55
|
OK I have introduced a hack, there is now a "format_number" attribute of <% input %> ie.. <% input name="field" handler="my_object" format_number="%.2f" %> It works for me, but I'm worried I might have broken something (at least the following side-effect: default_value was previously not html-encoded, now it will be. But I think that's a good thing? But I'm not sure.) I'm not particularly happy with this solution, but it works for me. Perhaps a format_date should be introduced as well. Cheers, Adrian 2008/6/26 Adrian Smith <adr...@gm...>: > I think the syntax for the macro is good like that .... > > I think there are two possible positions: > > 1. The number formatting should be two-way. This is like WebObjects or > Swing's NumberFormatter that you associate with an input field. If the > format is "1,234.12" then that's what the user sees, and that's what the > user types. > 2. Number formatting is two independent things. This is like how it is > in WebTek if there is |format_number. For output, the pipe is used. For > input, the "parse_number" routine is used. > > From a philosophical perspective, one would tend towards #1 as then it > would be impossible to make a mismatched number formatting system (e.g. > output "." but input ","). > > However, I would say, from a practical perspective, having used #1, they > are often inconvenient. In case "," were an html-escapable character, how > would that be implemented? If the user gets presented with thousand > separators "1,234", does the user have to type them when inputting data > (hopefully not!) What about currency symbols which are in the output - are > they mandatory for the input? > > So I think having a) parse_number being used (which is what you always want > - i.e. take the number, and work out what he means, even if it isn't the > exact format of the output), and b) |format_number being used to specify > exactly how we want the field to look when the form is presented, is a good > solution. > > > > 2008/6/26 max demmelbauer <pro...@gm...>: > > hmmm.. i looked into the framework-code, and i have no solution for this >> problem at the moment. i have to think about it a litte more (or do you have >> an idea, for the syntax a macro should look like?) >> >> >> On 26.06.2008, at 17:46, Adrian Smith wrote: >> >> Unfortunately this doesn't work: >> >> <% input class="FormFieldNumber" name="costs_national" handler="profile" | >> format_number format="%.2f" %> >> >> Yields a result like in the attachment "format-number-wrong" - i.e. it is >> no longer an input field. If I leave out the format_number pipe i.e. >> >> <% input class="FormFieldNumber" name="costs_national" handler="profile" >> %> >> >> Then it looks like an input field but doesn't have the number formatting >> right, see attachment "format-number-input" >> >> Cheers, Adrian >> >> >> >> 2008/6/16 max demmelbauer <pro...@gm...>: >> >>> you have to use the format_number filter. >>> >>> <% input name="costs_national" handler="profile" | format_number %> >>> >>> >>> >>> On 15.06.2008, at 12:13, Adrian Smith wrote: >>> >>> Thanks for your commits and face-to-face discussions concerning this >>> issue. >>> >>> Unfortunately I cannot get it to work. Maybe I am doing something wrong? >>> >>> (1) in MyApp/config/numbers.config I have: >>> >>> 'de' => { 'thousands_sep' => '.', 'decimal_point' => ',' }, >>> >>> (2) in the main CGI program I have: >>> >>> request->language("de"); >>> >>> The strings from "de.po" are displayed correctly (there is no "en.po") so >>> I am confident that the language is set correctly in the CGI. >>> >>> (3) in the template, I have: >>> >>> <% input name="costs_national" handler="profile" %> >>> >>> (4) the field in the MySQL database is a DECIMAL(10,2) >>> >>> However, I only get the English ("." decimal separator) used both (a) in >>> the display of values in the form field, and (b) in the parsing of the >>> value. >>> >>> I am sure this worked before? Or maybe I am mistaken? >>> >>> Thanks in advance for your help >>> >>> >>> >>> 2008/6/11 Adrian Smith <adr...@gm...>: >>> >>>> Thinking about this, one would definitely need some kind of filter that >>>> worked 2-way i.e. can convert firstly from an internal representation to an >>>> external representation (like the current filter), and also the other way >>>> around (for input fields). >>>> >>>> Similar to the NumberFormatter or DateFormatter concept in Cocoa and >>>> WebObjects: >>>> >>>> >>>> http://developer.apple.com/documentation/DeveloperTools/Reference/WO541Reference/com/webobjects/foundation/NSNumberFormatter.html >>>> >>>> 2008/6/11 Adrian Smith <adr...@gm...>: >>>> >>>>> I see that there is the filter "format_number" which takes into account >>>>> e.g. "." or "," for the decimal and thousand separators. That's really >>>>> great! >>>>> >>>>> Is there anything equivalent for data input? >>>>> >>>>> Specifically I have a database field of the type "decimal(10,2)" and I >>>>> have a text field which must display the data, and accept inputed data, >>>>> using the German decimal separator. >>>>> >>>> >>>> >>> >>> >> <format-number-wrong.png><format-number-input.png> >> >> >> > |
From: Adrian S. <adr...@gm...> - 2008-07-01 10:46:59
|
Works great - Thanks very much !! 2008/6/30 max demmelbauer <pro...@gm...>: > you have to use this config in your virtualhosts config: > PerlOptions +Parent > PerlSwitches -I/WebTek/app > PerlSwitches -I/WebTek/lib > PerlRequire /WebTek/extra/startup.pl > > > On Jun 30, 2008, at 11:07 AM, Adrian Smith wrote: > > Is it possible to install multiple instances of the same WebTek app on one > server using mod_perl? (I want to have a www.x.com and a dev.x.com which > use different templates) > > It seems to me that when I restart the server, and click on one of the two > sites e.g. dev, then the templates which have been read are used by both > applications. If I restart the server and do the first click on www, then > the same thing happens - the www template gets read and cached and seen by > both applications. > > Is this a known problem, or am I doing something wrong? If it's not a known > problem, I'll search more, maybe it's a problem in my config..... > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > > http://sourceforge.net/services/buy/index.php_______________________________________________ > Webtek-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webtek-devel > > > |
From: Adrian S. <adr...@gm...> - 2008-06-30 12:20:04
|
OK I have now implemented this feature! (Sorry for high volume of mail from me!) 2008/6/30 Adrian Smith <adr...@gm...>: > A new macro could be added, for example: > > <% select_from_list > list="<% profile.all_usims %> > iterator="usim" > value~"<% usim.id %>" > display~"<% usim.display_name | encode_html %> > selected="<% profile.selected_usim_object %>" > %> > > I think it would be a nice object-oriented way to create <select> > drop-downs. > > Currently, when I need to do something like the above, I create a new > macro, called e.g. <% select_usims %> in the page, build up the list of > "values" and "displays" and then return $self->select(...). > |
From: Adrian S. <adr...@gm...> - 2008-06-30 11:36:05
|
A new macro could be added, for example: <% select_from_list list="<% profile.all_usims %> iterator="usim" value~"<% usim.id %>" display~"<% usim.display_name | encode_html %> selected="<% profile.selected_usim_object %>" %> I think it would be a nice object-oriented way to create <select> drop-downs. Currently, when I need to do something like the above, I create a new macro, called e.g. <% select_usims %> in the page, build up the list of "values" and "displays" and then return $self->select(...). |
From: max d. <pro...@gm...> - 2008-06-30 10:32:30
|
i solve this problem with an separate user-page. Page/User.pm ========================== sub new_for_nickname :Path(user/(\w+)) { my ($class, $path, $nickname) = @_; my $user = app::Model::User->find_one(nickname => $nickname); return $user ? $class->new_for_user($user) : undef; } sub new_for_user { ... } sub index { ... } sub edit { my $self = shift; if (request->is_post) { $self->user->update(request->params->user); $self->user->save; session->user($self); response->message('User edited'); response->redirect($self->href); } } ... ========================== if you save a user-page in the session you have more power in the session.user macro. e.g all this things are possible: <% session.user.template ... %> <% session.user.nickname ... %> <% session.user.input name="nickname" ... %> ! but you are right. if you change the user-table layout you have to drop the session-table! (but this is not very often ;) On Jun 30, 2008, at 11:55 AM, Adrian Smith wrote: > I now realize this would not be a good strategy anyway! > > If one writes a "my account" screen by using "update" then "save" on > the session->user, and there is an error, then the page would be > redisplayed with an error (correct). But the user's attributes have > been altered, and will get persisted into the sesssion. If the user > navigates away, and then back to the "my account" page, the user > will still see the erroneous inputs of last time! > > It's necessary, in a "my account" page, to use a separate object- > instance to edit and try and save. This can be done using a "MyUser- > >find" in the constructor to retrieve a new instance (not "find_one" > as this uses a cache.) > > In fact I'm not sure it's that clean to store the whole user object > in the session. Maybe it would be better to just store the "id" and > the a md5 of the currently entered password. The user could be > fetched each time, which would mean that the user would still have > to exist, schema changes would not require the session table to be > deleted, etc. The md5 of the password would be necessary to check to > see if the user has changed their password on the server e.g. using > another session (in which case the first browser session should be > terminated.) But this is a topic for another thread.... > > > > 2008/6/30 Adrian Smith <adr...@gm...>: > OK the bug was somewhere else in the template (the error was simply > that "_can_macro" cannot be called on an undefined value so was > difficult to locate!) > > Now the page will be displayed - which is good - but all the form > values are blank, if I use handler="session.user" in the <%input%> > fields. (If I set > > $self->user(session->user) > > in the constructor, and use handler="user" in the template, then the > values are displayed.) > > > 2008/6/26 Adrian Smith <adr...@gm...>: > > What do you think about this? Is it possible to use "session.user" > as the "handler" in this sort of syntax? The "user" is a "Handler" > on the "session" object, so I think I should be able to use it like > this. > > But if it's not possible - then I shall just use another approach - > e.g. > > make_accessor("user", "Handler") > > in the page class, and set > > $self->user(session->user) > > in the constructor. Should also work, I think? (But is less elegant..) > > 2008/6/16 Adrian Smith <adr...@gm...>: > > The user logs in, and then there is some kind of "my account" screen > where various pieces of information can be edited by the user. I > have tried the following syntax: > > <% input name="first_name" handler="session.user" %> > > However, I get the error (that's possibly unrelated, I'm not sure...) > > general error, details: WebTek::Exception: error in > TariffCalc::Page::SalesPerson::DataEdit=HASH(0x2292420) during > action 'index': WebTek::Exception: error compiling template .../ > DataEdit/index.tpl, details Can't call method "_can_macro" on an > undefined value at D:/Adrian/customer-checkouts/webtek/lib/WebTek/ > Compiler.pm line 178. > > But the "session.user" should be not undef, as the following > template works: > > <% session.user.email_address_lower %> > > How should I approach this situation? > > Thanks > > > |
From: max d. <pro...@gm...> - 2008-06-30 10:22:29
|
handler="session.user" will not work, because the handler param can only be a hander of the current page. if you want to render an input- field with your session-user-nickname ists best to set the input-field default_value, or you write something like <% session.user.input name="nickname" %> but this only works if you set a user-page (not a user-obj) in your session. this handler property is not implementet very well at the moment so you have to use this workarounds.... i will think a little bit around this problem! On Jun 30, 2008, at 11:21 AM, Adrian Smith wrote: > OK the bug was somewhere else in the template (the error was simply > that "_can_macro" cannot be called on an undefined value so was > difficult to locate!) > > Now the page will be displayed - which is good - but all the form > values are blank, if I use handler="session.user" in the <%input%> > fields. (If I set > > $self->user(session->user) > > in the constructor, and use handler="user" in the template, then the > values are displayed.) > > > 2008/6/26 Adrian Smith <adr...@gm...>: > What do you think about this? Is it possible to use "session.user" > as the "handler" in this sort of syntax? The "user" is a "Handler" > on the "session" object, so I think I should be able to use it like > this. > > But if it's not possible - then I shall just use another approach - > e.g. > > make_accessor("user", "Handler") > > in the page class, and set > > $self->user(session->user) > > in the constructor. Should also work, I think? (But is less elegant..) > > 2008/6/16 Adrian Smith <adr...@gm...>: > > The user logs in, and then there is some kind of "my account" screen > where various pieces of information can be edited by the user. I > have tried the following syntax: > > <% input name="first_name" handler="session.user" %> > > However, I get the error (that's possibly unrelated, I'm not sure...) > > general error, details: WebTek::Exception: error in > TariffCalc::Page::SalesPerson::DataEdit=HASH(0x2292420) during > action 'index': WebTek::Exception: error compiling template .../ > DataEdit/index.tpl, details Can't call method "_can_macro" on an > undefined value at D:/Adrian/customer-checkouts/webtek/lib/WebTek/ > Compiler.pm line 178. > > But the "session.user" should be not undef, as the following > template works: > > <% session.user.email_address_lower %> > > How should I approach this situation? > > Thanks > > |
From: max d. <pro...@gm...> - 2008-06-30 10:18:25
|
you have to use this config in your virtualhosts config: PerlOptions +Parent PerlSwitches -I/WebTek/app PerlSwitches -I/WebTek/lib PerlRequire /WebTek/extra/startup.pl On Jun 30, 2008, at 11:07 AM, Adrian Smith wrote: > Is it possible to install multiple instances of the same WebTek app > on one server using mod_perl? (I want to have a www.x.com and a > dev.x.com which use different templates) > > It seems to me that when I restart the server, and click on one of > the two sites e.g. dev, then the templates which have been read are > used by both applications. If I restart the server and do the first > click on www, then the same thing happens - the www template gets > read and cached and seen by both applications. > > Is this a known problem, or am I doing something wrong? If it's not > a known problem, I'll search more, maybe it's a problem in my > config..... > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php_______________________________________________ > Webtek-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webtek-devel |
From: Adrian S. <adr...@gm...> - 2008-06-30 09:55:28
|
I now realize this would not be a good strategy anyway! If one writes a "my account" screen by using "update" then "save" on the session->user, and there is an error, then the page would be redisplayed with an error (correct). But the user's attributes have been altered, and will get persisted into the sesssion. If the user navigates away, and then back to the "my account" page, the user will still see the erroneous inputs of last time! It's necessary, in a "my account" page, to use a separate object-instance to edit and try and save. This can be done using a "MyUser->find" in the constructor to retrieve a new instance (not "find_one" as this uses a cache.) In fact I'm not sure it's that clean to store the whole user object in the session. Maybe it would be better to just store the "id" and the a md5 of the currently entered password. The user could be fetched each time, which would mean that the user would still have to exist, schema changes would not require the session table to be deleted, etc. The md5 of the password would be necessary to check to see if the user has changed their password on the server e.g. using another session (in which case the first browser session should be terminated.) But this is a topic for another thread.... 2008/6/30 Adrian Smith <adr...@gm...>: > OK the bug was somewhere else in the template (the error was simply that > "_can_macro" cannot be called on an undefined value so was difficult to > locate!) > > Now the page will be displayed - which is good - but all the form values > are blank, if I use handler="session.user" in the <%input%> fields. (If I > set > > $self->user(session->user) > > in the constructor, and use handler="user" in the template, then the values > are displayed.) > > > 2008/6/26 Adrian Smith <adr...@gm...>: > > What do you think about this? Is it possible to use "session.user" as the >> "handler" in this sort of syntax? The "user" is a "Handler" on the "session" >> object, so I think I should be able to use it like this. >> >> But if it's not possible - then I shall just use another approach - e.g. >> >> make_accessor("user", "Handler") >> >> in the page class, and set >> >> $self->user(session->user) >> >> in the constructor. Should also work, I think? (But is less elegant..) >> >> 2008/6/16 Adrian Smith <adr...@gm...>: >> >> The user logs in, and then there is some kind of "my account" screen where >>> various pieces of information can be edited by the user. I have tried the >>> following syntax: >>> >>> <% input name="first_name" handler="session.user" %> >>> >>> However, I get the error (that's possibly unrelated, I'm not sure...) >>> >>> general error, details: WebTek::Exception: error in >>> TariffCalc::Page::SalesPerson::DataEdit=HASH(0x2292420) during action >>> 'index': WebTek::Exception: error compiling template .../DataEdit/index.tpl, >>> details Can't call method "_can_macro" on an undefined value at >>> D:/Adrian/customer-checkouts/webtek/lib/WebTek/Compiler.pm line 178. >>> >>> But the "session.user" should be not undef, as the following template >>> works: >>> >>> <% session.user.email_address_lower %> >>> >>> How should I approach this situation? >>> >>> Thanks >>> >> >> > |
From: Adrian S. <adr...@gm...> - 2008-06-30 09:22:00
|
OK the bug was somewhere else in the template (the error was simply that "_can_macro" cannot be called on an undefined value so was difficult to locate!) Now the page will be displayed - which is good - but all the form values are blank, if I use handler="session.user" in the <%input%> fields. (If I set $self->user(session->user) in the constructor, and use handler="user" in the template, then the values are displayed.) 2008/6/26 Adrian Smith <adr...@gm...>: > What do you think about this? Is it possible to use "session.user" as the > "handler" in this sort of syntax? The "user" is a "Handler" on the "session" > object, so I think I should be able to use it like this. > > But if it's not possible - then I shall just use another approach - e.g. > > make_accessor("user", "Handler") > > in the page class, and set > > $self->user(session->user) > > in the constructor. Should also work, I think? (But is less elegant..) > > 2008/6/16 Adrian Smith <adr...@gm...>: > > The user logs in, and then there is some kind of "my account" screen where >> various pieces of information can be edited by the user. I have tried the >> following syntax: >> >> <% input name="first_name" handler="session.user" %> >> >> However, I get the error (that's possibly unrelated, I'm not sure...) >> >> general error, details: WebTek::Exception: error in >> TariffCalc::Page::SalesPerson::DataEdit=HASH(0x2292420) during action >> 'index': WebTek::Exception: error compiling template .../DataEdit/index.tpl, >> details Can't call method "_can_macro" on an undefined value at >> D:/Adrian/customer-checkouts/webtek/lib/WebTek/Compiler.pm line 178. >> >> But the "session.user" should be not undef, as the following template >> works: >> >> <% session.user.email_address_lower %> >> >> How should I approach this situation? >> >> Thanks >> > > |
From: Adrian S. <adr...@gm...> - 2008-06-30 09:07:29
|
Is it possible to install multiple instances of the same WebTek app on one server using mod_perl? (I want to have a www.x.com and a dev.x.com which use different templates) It seems to me that when I restart the server, and click on one of the two sites e.g. dev, then the templates which have been read are used by both applications. If I restart the server and do the first click on www, then the same thing happens - the www template gets read and cached and seen by both applications. Is this a known problem, or am I doing something wrong? If it's not a known problem, I'll search more, maybe it's a problem in my config..... |
From: max d. <pro...@gm...> - 2008-06-28 15:23:29
|
yes thats right, it is not possible to make subclasses of pages without the parent definition, because all relations between pages are stored in WebTek::Parent and not in the concrete Page-class. maybe this is not the oo-way, but it was very easy to implement. if you define the parent relations in an oo-way, you have to loop all pages if you want to find all children for a specific page! hmm.. this is also not very difficult, but i never needed this feature, because i never subclassed pages. maybe i will change this in future?? On Jun 27, 2008, at 12:43 PM, Adrian Smith wrote: > OK this isn't too serious a problem - as it has an easy workaround > yet a solution to the problem may not be so simple - so maybe isn't > worth solving. > > I have the following pages: > ReportList > ReportView (abstract; WebTek::Parent(ReportList)) > UsimListReportView (extends ReportView) > CompariosnReportView (extends ReportView) > Basically I have a list of reports, displayed in the ReportList > page, and when you click on a particular report, then the child page > comes which contains the report. The two types of reports are very > similar but not identical. The code of the differences also needs to > have access to front-end things such as localization, number > formatting, etc., and reports are fundamentally about presenting > data to the user, so I think it's appropriate that the code is in > the front-end as opposed to in some "back-end". > > However, all ReportView subclasses are children of ReportList and > therefore in ReportView I wrote: > > # ReportView > use WebTek::Parent qw( MyApp::Page::ReportList) > > And in the concrete subclass I wrote: > > # UsimListReportView > sub new :Path(usim-list) { ... } > > However that didn't work - when one entered a URL of one of the > concrete subclass (/reports/usim-list) it didn't work. When I added > the WebTek::Parent line to the concrete subclass, then it worked. > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php_______________________________________________ > Webtek-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webtek-devel |
From: Adrian S. <adr...@gm...> - 2008-06-27 10:43:16
|
OK this isn't too serious a problem - as it has an easy workaround yet a solution to the problem may not be so simple - so maybe isn't worth solving. I have the following pages: - ReportList - ReportView (abstract; WebTek::Parent(ReportList)) - UsimListReportView (extends ReportView) - CompariosnReportView (extends ReportView) Basically I have a list of reports, displayed in the ReportList page, and when you click on a particular report, then the child page comes which contains the report. The two types of reports are very similar but not identical. The code of the differences also needs to have access to front-end things such as localization, number formatting, etc., and reports are fundamentally about presenting data to the user, so I think it's appropriate that the code is in the front-end as opposed to in some "back-end". However, all ReportView subclasses are children of ReportList and therefore in ReportView I wrote: # ReportView use WebTek::Parent qw( MyApp::Page::ReportList) And in the concrete subclass I wrote: # UsimListReportView sub new :Path(usim-list) { ... } However that didn't work - when one entered a URL of one of the concrete subclass (/reports/usim-list) it didn't work. When I added the WebTek::Parent line to the concrete subclass, then it worked. |
From: Adrian S. <adr...@gm...> - 2008-06-26 16:55:04
|
What do you think about this? Is it possible to use "session.user" as the "handler" in this sort of syntax? The "user" is a "Handler" on the "session" object, so I think I should be able to use it like this. But if it's not possible - then I shall just use another approach - e.g. make_accessor("user", "Handler") in the page class, and set $self->user(session->user) in the constructor. Should also work, I think? (But is less elegant..) 2008/6/16 Adrian Smith <adr...@gm...>: > The user logs in, and then there is some kind of "my account" screen where > various pieces of information can be edited by the user. I have tried the > following syntax: > > <% input name="first_name" handler="session.user" %> > > However, I get the error (that's possibly unrelated, I'm not sure...) > > general error, details: WebTek::Exception: error in > TariffCalc::Page::SalesPerson::DataEdit=HASH(0x2292420) during action > 'index': WebTek::Exception: error compiling template .../DataEdit/index.tpl, > details Can't call method "_can_macro" on an undefined value at > D:/Adrian/customer-checkouts/webtek/lib/WebTek/Compiler.pm line 178. > > But the "session.user" should be not undef, as the following template > works: > > <% session.user.email_address_lower %> > > How should I approach this situation? > > Thanks > |
From: Adrian S. <adr...@gm...> - 2008-06-26 16:46:26
|
I think the syntax for the macro is good like that .... I think there are two possible positions: 1. The number formatting should be two-way. This is like WebObjects or Swing's NumberFormatter that you associate with an input field. If the format is "1,234.12" then that's what the user sees, and that's what the user types. 2. Number formatting is two independent things. This is like how it is in WebTek if there is |format_number. For output, the pipe is used. For input, the "parse_number" routine is used. >From a philosophical perspective, one would tend towards #1 as then it would be impossible to make a mismatched number formatting system (e.g. output "." but input ","). However, I would say, from a practical perspective, having used #1, they are often inconvenient. In case "," were an html-escapable character, how would that be implemented? If the user gets presented with thousand separators "1,234", does the user have to type them when inputting data (hopefully not!) What about currency symbols which are in the output - are they mandatory for the input? So I think having a) parse_number being used (which is what you always want - i.e. take the number, and work out what he means, even if it isn't the exact format of the output), and b) |format_number being used to specify exactly how we want the field to look when the form is presented, is a good solution. 2008/6/26 max demmelbauer <pro...@gm...>: > hmmm.. i looked into the framework-code, and i have no solution for this > problem at the moment. i have to think about it a litte more (or do you have > an idea, for the syntax a macro should look like?) > > > On 26.06.2008, at 17:46, Adrian Smith wrote: > > Unfortunately this doesn't work: > > <% input class="FormFieldNumber" name="costs_national" handler="profile" | > format_number format="%.2f" %> > > Yields a result like in the attachment "format-number-wrong" - i.e. it is > no longer an input field. If I leave out the format_number pipe i.e. > > <% input class="FormFieldNumber" name="costs_national" handler="profile" %> > > Then it looks like an input field but doesn't have the number formatting > right, see attachment "format-number-input" > > Cheers, Adrian > > > > 2008/6/16 max demmelbauer <pro...@gm...>: > >> you have to use the format_number filter. >> >> <% input name="costs_national" handler="profile" | format_number %> >> >> >> >> On 15.06.2008, at 12:13, Adrian Smith wrote: >> >> Thanks for your commits and face-to-face discussions concerning this >> issue. >> >> Unfortunately I cannot get it to work. Maybe I am doing something wrong? >> >> (1) in MyApp/config/numbers.config I have: >> >> 'de' => { 'thousands_sep' => '.', 'decimal_point' => ',' }, >> >> (2) in the main CGI program I have: >> >> request->language("de"); >> >> The strings from "de.po" are displayed correctly (there is no "en.po") so >> I am confident that the language is set correctly in the CGI. >> >> (3) in the template, I have: >> >> <% input name="costs_national" handler="profile" %> >> >> (4) the field in the MySQL database is a DECIMAL(10,2) >> >> However, I only get the English ("." decimal separator) used both (a) in >> the display of values in the form field, and (b) in the parsing of the >> value. >> >> I am sure this worked before? Or maybe I am mistaken? >> >> Thanks in advance for your help >> >> >> >> 2008/6/11 Adrian Smith <adr...@gm...>: >> >>> Thinking about this, one would definitely need some kind of filter that >>> worked 2-way i.e. can convert firstly from an internal representation to an >>> external representation (like the current filter), and also the other way >>> around (for input fields). >>> >>> Similar to the NumberFormatter or DateFormatter concept in Cocoa and >>> WebObjects: >>> >>> >>> http://developer.apple.com/documentation/DeveloperTools/Reference/WO541Reference/com/webobjects/foundation/NSNumberFormatter.html >>> >>> 2008/6/11 Adrian Smith <adr...@gm...>: >>> >>>> I see that there is the filter "format_number" which takes into account >>>> e.g. "." or "," for the decimal and thousand separators. That's really >>>> great! >>>> >>>> Is there anything equivalent for data input? >>>> >>>> Specifically I have a database field of the type "decimal(10,2)" and I >>>> have a text field which must display the data, and accept inputed data, >>>> using the German decimal separator. >>>> >>> >>> >> >> > <format-number-wrong.png><format-number-input.png> > > > |
From: Adrian S. <adr...@gm...> - 2008-06-26 16:41:52
|
That works perfectly - On all browsers - Thankyou very much !!!!! 2008/6/26 max demmelbauer <pro...@gm...>: > > On 26.06.2008, at 18:00, Adrian Smith wrote: > > If one has an upload form, what is the correct way of determining if a >> file has been uploaded or not? >> >> With the template: >> >> <% form enctype="multipart/form-data" %> >> <% input name="name" handler="marketing_material" %> >> .... >> <% form_end %> >> >> And the following in the code: >> >> sub create :Action { >> my $self = shift; >> >> if (request->is_post) { >> my $upload = request->upload("file"); # WebTek::Request::Upload >> unless (defined($upload)) { >> ..... >> >> With the Engine::ModPerl2, the "unless" part is never entered, even if no >> file is entered in the form in the browser. Somehow this was different with >> t he Engine::CGI. Hmm. >> >> What should I do? (Then I should probably update the Engine::CGI that it >> works the same way.) >> > > yep, thats a bug.. the behaviour fom CGI.pm is the correct one. i have > updated the trunk so that ModPerl2 should work correctly. but i havent > testet it... (but i think it should work, please test yourself) > > |
From: max d. <pro...@gm...> - 2008-06-26 16:39:50
|
hmmm.. i looked into the framework-code, and i have no solution for this problem at the moment. i have to think about it a litte more (or do you have an idea, for the syntax a macro should look like?) On 26.06.2008, at 17:46, Adrian Smith wrote: > Unfortunately this doesn't work: > > <% input class="FormFieldNumber" name="costs_national" > handler="profile" | format_number format="%.2f" %> > > Yields a result like in the attachment "format-number-wrong" - i.e. > it is no longer an input field. If I leave out the format_number > pipe i.e. > > <% input class="FormFieldNumber" name="costs_national" > handler="profile" %> > > Then it looks like an input field but doesn't have the number > formatting right, see attachment "format-number-input" > > Cheers, Adrian > > > > 2008/6/16 max demmelbauer <pro...@gm...>: > you have to use the format_number filter. > > <% input name="costs_national" handler="profile" | format_number %> > > > > On 15.06.2008, at 12:13, Adrian Smith wrote: > >> Thanks for your commits and face-to-face discussions concerning >> this issue. >> >> Unfortunately I cannot get it to work. Maybe I am doing something >> wrong? >> >> (1) in MyApp/config/numbers.config I have: >> >> 'de' => { 'thousands_sep' => '.', 'decimal_point' => ',' }, >> >> (2) in the main CGI program I have: >> >> request->language("de"); >> >> The strings from "de.po" are displayed correctly (there is no >> "en.po") so I am confident that the language is set correctly in >> the CGI. >> >> (3) in the template, I have: >> >> <% input name="costs_national" handler="profile" %> >> >> (4) the field in the MySQL database is a DECIMAL(10,2) >> >> However, I only get the English ("." decimal separator) used both >> (a) in the display of values in the form field, and (b) in the >> parsing of the value. >> >> I am sure this worked before? Or maybe I am mistaken? >> >> Thanks in advance for your help >> >> >> >> 2008/6/11 Adrian Smith <adr...@gm...>: >> Thinking about this, one would definitely need some kind of filter >> that worked 2-way i.e. can convert firstly from an internal >> representation to an external representation (like the current >> filter), and also the other way around (for input fields). >> >> Similar to the NumberFormatter or DateFormatter concept in Cocoa >> and WebObjects: >> >> http://developer.apple.com/documentation/DeveloperTools/Reference/WO541Reference/com/webobjects/foundation/NSNumberFormatter.html >> >> 2008/6/11 Adrian Smith <adr...@gm...>: >> >> I see that there is the filter "format_number" which takes into >> account e.g. "." or "," for the decimal and thousand separators. >> That's really great! >> >> Is there anything equivalent for data input? >> >> Specifically I have a database field of the type "decimal(10,2)" >> and I have a text field which must display the data, and accept >> inputed data, using the German decimal separator. >> >> > > > <format-number-wrong.png><format-number-input.png> |
From: max d. <pro...@gm...> - 2008-06-26 16:37:32
|
On 26.06.2008, at 18:00, Adrian Smith wrote: > If one has an upload form, what is the correct way of determining if > a file has been uploaded or not? > > With the template: > > <% form enctype="multipart/form-data" %> > <% input name="name" handler="marketing_material" %> > .... > <% form_end %> > > And the following in the code: > > sub create :Action { > my $self = shift; > > if (request->is_post) { > my $upload = request->upload("file"); # > WebTek::Request::Upload > unless (defined($upload)) { > ..... > > With the Engine::ModPerl2, the "unless" part is never entered, even > if no file is entered in the form in the browser. Somehow this was > different with t he Engine::CGI. Hmm. > > What should I do? (Then I should probably update the Engine::CGI > that it works the same way.) yep, thats a bug.. the behaviour fom CGI.pm is the correct one. i have updated the trunk so that ModPerl2 should work correctly. but i havent testet it... (but i think it should work, please test yourself) |
From: Adrian S. <adr...@gm...> - 2008-06-26 16:32:57
|
OK - I agree (I think) that there needs to be some attribute so that not every method is reachable from the front-end - but I am just not sure that the differentiation between "Macro" and "Handler" is necessary. On the other hand I think most Java web frameworks allow you to put any attribute on the front-end as long as it has the JavaBeans "getXx" notation. And WebObjects also didn't have any special syntax to state that an attribute is accessible from the front-end. But still - I like it - I think it means the class has a much smaller "interface" from the front-end perspective. And small interfaces are good. Maybe the separation between Macro and Handler is necessary from an implementation perspective? But it sure confused me. I didn't expect this differentiation. And still, I have to admit, when programming, I do :Macro, then if it doesn't work, change it to :Handler and see if that works.... 2008/6/26 max demmelbauer <pro...@gm...>: > the Macro | Handler params are needed > > * to check the template-syntax during template-compile-time > * to dont allow access to every variable within templates (i.e. you let the > user modify templates) > * to generate documentation > > if you dont want that check, you can set the failmode="silent" property: > > <% box.get_dimensions.get_value failmode="silent" %> > > in case of an runtime-error (during rendering the template) an empty-string > is returned for this macro. > > ...hmmm... but this behavour is still a work in progress. > > On 26.06.2008, at 17:50, Adrian Smith wrote: > > OK - Thanks for the description. > > I am not sure I agree/understand the difference between a Handler and a > Macro. I mean they could just be the same? > > Sometimes a Macro returns a non-string (e.g. as the input for the "list" > paramter of "foreach") so given that Macros return "anything" - strings, > lists, objects - it would make sense for attributes of them (with the "." > syntax) to be usable. > > I mean in programming languages, you can write: > > - $box > - $box->get_dimensions() > - $box->get_dimensions()->get_width() > > There is no distinction where the first doesn't work at all, the second > only works if get_dimensions is a Macro, and the third only works if > get_dimensions is a Handler. > > But anyway - now I understand the difference (I think) - so it doesn't > matter too much on a practical level for me. > > > > 2008/6/16 max demmelbauer <pro...@gm...>: > >> hmmm.. this is no bug, because you used the macro in a wrong way. >> >> the format of a macro is defined like: >> >> <% handler.handler.macro_name param1="abc" param2=" ... <% ... %> ..." | >> filter1 | filter2 param="..." %> >> >> if you omit the handler (i.e. you want to call a macro in the current >> page) you can write: >> >> <% macro_name param1="abc" param2=" ... <% ... %> ..." | filter1 | filter2 >> param="..." %> >> >> for better understanding you can think the above macro-call is the same >> as: >> >> <% actual_page.macro_name ... %> >> >> (but the handler actual_page dont exists, because it's already the >> default) >> >> >> so to your example: >> >> i think you want to put the current iterator (which is a handler obj) as a >> param to a macro, like: >> >> sub a_macro { >> my ($self, %params) = @_; >> >> return $params{'iterator_obj'}->some_macro(); >> } >> >> but this is not possible because, when you write: >> >> <% a_macro iterator_obj="<% xyz %>" %> >> >> xyz is called as a macro function for the current page (and this is >> exactly the error-msg from your example) >> >> so, there are two solutions for this problem. >> >> 1) our solution with the self macro have done the trick (because it >> returns the handler obj) >> >> 2) handler xyz is already defined for the current page (from the foreach >> macro), so you can write in the macro-code: >> >> sub a_macro { >> my ($self, %params) = @_; >> >> return $self->handler($params{'handler_name'})->some_macro(); >> } >> >> and in the template >> >> <% foreach iterator="xyz" do~q{ >> <% a_macro handler_name="xyz" %> >> } %> >> >> hmmm... i think the second solution is not as nice as the first, because >> you have to split the logic: half in the template (the handler-name) and >> half in macro-code (handler-obj for the handler-name).. and this solution >> also only works in the same page, where the foreach is called. so a >> >> <% foreach iterator="xyz" do~q{ >> <% parent.a_macro handler_name="xyz" %> >> } %> >> >> wouldn't work! >> >> so i think we should implement a general macro which returns the obj of >> the current handler (like your self macro). what would you think is the >> right name for such an macro? >> >> is >> >> sub self :Macro { ... } a good name? >> >> i think its ok, so we should implement this in WebTek/Handler.pm >> >> lg. max. >> >> >> On 15.06.2008, at 13:49, Adrian Smith wrote: >> >> I just searched for ages for this bug! >> >> <% foreach list="...." iterator="xyz" do~q{ >> <% a_macro param="<% xyz %>" %> >> } %> >> >> This doesn't work, producing the error: >> >> macro_error : MyApp::Page::MyPage=HASH(0x227f904) has no macro 'xyz' >> >> If I implement the following method in class Xyz: >> >> sub self :Macro { >> my $self = shift; >> return $self; >> } >> >> and then put the following in the template: >> >> <% foreach list="...." iterator="xyz" do~q{ >> <% a_macro param="<% xyz.self %>" %> >> } %> >> >> Then it works fine >> >> >> > > |
From: max d. <pro...@gm...> - 2008-06-26 16:18:34
|
the Macro | Handler params are needed * to check the template-syntax during template-compile-time * to dont allow access to every variable within templates (i.e. you let the user modify templates) * to generate documentation if you dont want that check, you can set the failmode="silent" property: <% box.get_dimensions.get_value failmode="silent" %> in case of an runtime-error (during rendering the template) an empty- string is returned for this macro. ...hmmm... but this behavour is still a work in progress. On 26.06.2008, at 17:50, Adrian Smith wrote: > OK - Thanks for the description. > > I am not sure I agree/understand the difference between a Handler > and a Macro. I mean they could just be the same? > > Sometimes a Macro returns a non-string (e.g. as the input for the > "list" paramter of "foreach") so given that Macros return "anything" > - strings, lists, objects - it would make sense for attributes of > them (with the "." syntax) to be usable. > > I mean in programming languages, you can write: > $box > $box->get_dimensions() > $box->get_dimensions()->get_width() > There is no distinction where the first doesn't work at all, the > second only works if get_dimensions is a Macro, and the third only > works if get_dimensions is a Handler. > > But anyway - now I understand the difference (I think) - so it > doesn't matter too much on a practical level for me. > > > > 2008/6/16 max demmelbauer <pro...@gm...>: > hmmm.. this is no bug, because you used the macro in a wrong way. > > the format of a macro is defined like: > > <% handler.handler.macro_name param1="abc" param2=" ... <% ... > %> ..." | filter1 | filter2 param="..." %> > > if you omit the handler (i.e. you want to call a macro in the > current page) you can write: > > <% macro_name param1="abc" param2=" ... <% ... %> ..." | filter1 | > filter2 param="..." %> > > for better understanding you can think the above macro-call is the > same as: > > <% actual_page.macro_name ... %> > > (but the handler actual_page dont exists, because it's already the > default) > > > so to your example: > > i think you want to put the current iterator (which is a handler > obj) as a param to a macro, like: > > sub a_macro { > my ($self, %params) = @_; > > return $params{'iterator_obj'}->some_macro(); > } > > but this is not possible because, when you write: > > <% a_macro iterator_obj="<% xyz %>" %> > > xyz is called as a macro function for the current page (and this is > exactly the error-msg from your example) > > so, there are two solutions for this problem. > > 1) our solution with the self macro have done the trick (because it > returns the handler obj) > > 2) handler xyz is already defined for the current page (from the > foreach macro), so you can write in the macro-code: > > sub a_macro { > my ($self, %params) = @_; > > return $self->handler($params{'handler_name'})->some_macro(); > } > > and in the template > > <% foreach iterator="xyz" do~q{ > <% a_macro handler_name="xyz" %> > } %> > > hmmm... i think the second solution is not as nice as the first, > because you have to split the logic: half in the template (the > handler-name) and half in macro-code (handler-obj for the handler- > name).. and this solution also only works in the same page, where > the foreach is called. so a > > <% foreach iterator="xyz" do~q{ > <% parent.a_macro handler_name="xyz" %> > } %> > > wouldn't work! > > so i think we should implement a general macro which returns the obj > of the current handler (like your self macro). what would you think > is the right name for such an macro? > > is > > sub self :Macro { ... } a good name? > > i think its ok, so we should implement this in WebTek/Handler.pm > > lg. max. > > > On 15.06.2008, at 13:49, Adrian Smith wrote: > >> I just searched for ages for this bug! >> >> <% foreach list="...." iterator="xyz" do~q{ >> <% a_macro param="<% xyz %>" %> >> } %> >> >> This doesn't work, producing the error: >> >> macro_error : MyApp::Page::MyPage=HASH(0x227f904) has no macro 'xyz' >> >> If I implement the following method in class Xyz: >> >> sub self :Macro { >> my $self = shift; >> return $self; >> } >> >> and then put the following in the template: >> >> <% foreach list="...." iterator="xyz" do~q{ >> <% a_macro param="<% xyz.self %>" %> >> } %> >> >> Then it works fine > > |
From: Adrian S. <adr...@gm...> - 2008-06-26 16:00:52
|
If one has an upload form, what is the correct way of determining if a file has been uploaded or not? With the template: <% form enctype="multipart/form-data" %> <% input name="name" handler="marketing_material" %> .... <% form_end %> And the following in the code: sub create :Action { my $self = shift; if (request->is_post) { my $upload = request->upload("file"); # WebTek::Request::Upload unless (defined($upload)) { ..... With the Engine::ModPerl2, the "unless" part is never entered, even if no file is entered in the form in the browser. Somehow this was different with the Engine::CGI. Hmm. What should I do? (Then I should probably update the Engine::CGI that it works the same way.) Thanks! |
From: Adrian S. <adr...@gm...> - 2008-06-26 15:50:35
|
OK - Thanks for the description. I am not sure I agree/understand the difference between a Handler and a Macro. I mean they could just be the same? Sometimes a Macro returns a non-string (e.g. as the input for the "list" paramter of "foreach") so given that Macros return "anything" - strings, lists, objects - it would make sense for attributes of them (with the "." syntax) to be usable. I mean in programming languages, you can write: - $box - $box->get_dimensions() - $box->get_dimensions()->get_width() There is no distinction where the first doesn't work at all, the second only works if get_dimensions is a Macro, and the third only works if get_dimensions is a Handler. But anyway - now I understand the difference (I think) - so it doesn't matter too much on a practical level for me. 2008/6/16 max demmelbauer <pro...@gm...>: > hmmm.. this is no bug, because you used the macro in a wrong way. > > the format of a macro is defined like: > > <% handler.handler.macro_name param1="abc" param2=" ... <% ... %> ..." | > filter1 | filter2 param="..." %> > > if you omit the handler (i.e. you want to call a macro in the current page) > you can write: > > <% macro_name param1="abc" param2=" ... <% ... %> ..." | filter1 | filter2 > param="..." %> > > for better understanding you can think the above macro-call is the same as: > > <% actual_page.macro_name ... %> > > (but the handler actual_page dont exists, because it's already the default) > > > so to your example: > > i think you want to put the current iterator (which is a handler obj) as a > param to a macro, like: > > sub a_macro { > my ($self, %params) = @_; > > return $params{'iterator_obj'}->some_macro(); > } > > but this is not possible because, when you write: > > <% a_macro iterator_obj="<% xyz %>" %> > > xyz is called as a macro function for the current page (and this is exactly > the error-msg from your example) > > so, there are two solutions for this problem. > > 1) our solution with the self macro have done the trick (because it returns > the handler obj) > > 2) handler xyz is already defined for the current page (from the foreach > macro), so you can write in the macro-code: > > sub a_macro { > my ($self, %params) = @_; > > return $self->handler($params{'handler_name'})->some_macro(); > } > > and in the template > > <% foreach iterator="xyz" do~q{ > <% a_macro handler_name="xyz" %> > } %> > > hmmm... i think the second solution is not as nice as the first, because > you have to split the logic: half in the template (the handler-name) and > half in macro-code (handler-obj for the handler-name).. and this solution > also only works in the same page, where the foreach is called. so a > > <% foreach iterator="xyz" do~q{ > <% parent.a_macro handler_name="xyz" %> > } %> > > wouldn't work! > > so i think we should implement a general macro which returns the obj of the > current handler (like your self macro). what would you think is the right > name for such an macro? > > is > > sub self :Macro { ... } a good name? > > i think its ok, so we should implement this in WebTek/Handler.pm > > lg. max. > > > On 15.06.2008, at 13:49, Adrian Smith wrote: > > I just searched for ages for this bug! > > <% foreach list="...." iterator="xyz" do~q{ > <% a_macro param="<% xyz %>" %> > } %> > > This doesn't work, producing the error: > > macro_error : MyApp::Page::MyPage=HASH(0x227f904) has no macro 'xyz' > > If I implement the following method in class Xyz: > > sub self :Macro { > my $self = shift; > return $self; > } > > and then put the following in the template: > > <% foreach list="...." iterator="xyz" do~q{ > <% a_macro param="<% xyz.self %>" %> > } %> > > Then it works fine > > > |
From: Adrian S. <adr...@gm...> - 2008-06-16 15:47:10
|
The user logs in, and then there is some kind of "my account" screen where various pieces of information can be edited by the user. I have tried the following syntax: <% input name="first_name" handler="session.user" %> However, I get the error (that's possibly unrelated, I'm not sure...) general error, details: WebTek::Exception: error in TariffCalc::Page::SalesPerson::DataEdit=HASH(0x2292420) during action 'index': WebTek::Exception: error compiling template .../DataEdit/index.tpl, details Can't call method "_can_macro" on an undefined value at D:/Adrian/customer-checkouts/webtek/lib/WebTek/Compiler.pm line 178. But the "session.user" should be not undef, as the following template works: <% session.user.email_address_lower %> How should I approach this situation? Thanks |
From: Adrian S. <adr...@gm...> - 2008-06-16 10:20:23
|
Ah but I need this in an input field: when I do: <% input name="amount" default_value="<% zone_amount zone_obj="<% zone_obj.self %>" %>" | format_number format="%.2f" %> Then I get text in the webpage as opposed to an input field. In the above case I can hack it because I have a "default value" which is a macro; there I can place the "format_number" pipe. But in other cases, where the default value happens automatically, i.e. is taken from the model, for example: <% input name="amount" handler="profile_cost" %> Then I don't have any "default_value", so i don't know what the syntax should be here? (I get "12.23" as opposed to "12,23" although language=de and numbers.config is correct.) Thanks, Adrian 2008/6/16 max demmelbauer <pro...@gm...>: > >> <% profie.costs_national | format_number format="%.2f" %> >> > > you have guessed exactly the syntax ;) .... this is already implemented... > |