Re: [Webware-discuss] PSP interface to middlekit videos
application (sorry about crazy html message)
From: Geoffrey T. <gta...@na...> - 2002-01-09 14:48:41
|
At 02:18 PM 1/8/02 +0000, McDonald, Ross wrote: >Sorry about the garbled message, I think its to do with hotmail and slow >internet connection. >Anyway, the gist of it was, are their any examples lying about of good >practices to employ in psp pages where we seek to separate content from >presentation, and are their any sample pages of the type where we connect to >a middlekit layer and therefore access sql database? I don't have any samples to refer you to. But I can at least mention the way I separate content from presentation. I put the methods that provide the "content" into base classes that are derived from Page. Actually I have a whole hierarchy of base classes depending on the type of web page. These base classes are located in a separate Python package -- they are not in the context directory. Then the context contains PSPs which are used to present the content as HTML. This is done by making the PSP inherit from the correct base class (see the PSP documentation for details on how to do this) and then the PSP utilizes the methods of the base class to fetch the content and format it appropriately as HTML. In this way you can have a very minimal amount of Python code in your PSP's -- just a few imports, looping, conditionals, calls to formatting functions, etc. -- - Geoff Talvola gta...@Na... |
Re: [Webware-discuss] PSP interface to middlekit videos application
(sorry about crazy html message)
From: Jason H. <ja...@pe...> - 2002-01-09 16:19:04
|
At 02:18 PM 1/8/02 +0000, McDonald, Ross wrote: >Sorry about the garbled message, I think its to do with hotmail and slow >internet connection. >Anyway, the gist of it was, are their any examples lying about of good >practices to employ in psp pages where we seek to separate content from >presentation, and are their any sample pages of the type where we connect to >a middlekit layer and therefore access sql database? The only samples I've found of using the middlekit from a servlet are the MKBrowser source files (part of middlekit itself), located under Webware/MiddleKit/WebBrowser. Hope that helps. Peace, Jason |
From: John H. <jho...@to...> - 2002-01-09 23:09:50
|
I've been learning about MiddleKit today and something struck me as peculiar- the Quickstart says to design your objects in a CSV spreadsheet, and that it will then generate code. It also says that regenerating the code is often needed as design changes. But I might want to add additional methods etc to the objects. Wouldn't that code be lost in the regeneration? That sounds like it would be kind of a pain. Is that actually a problem in use of MiddleKit? John |
From: Ian B. <ia...@co...> - 2002-01-09 23:19:50
|
Each MK object is composed of a generated portion, and a subclass that you can customize. You'll notice the subclass (which is just boilerplate) is very boring, and will not change as you change your model, so you are safe. The superclass (named, I think, as *Gen) will get overwritten, and you should not edit that code. I think MK places those generated classes in a different directory. On Wed, 2002-01-09 at 17:09, John Holland wrote: > I've been learning about MiddleKit today and something struck me as peculiar- > > the Quickstart says to design your objects in a CSV spreadsheet, and that it > will then generate code. It also says that regenerating the code is often > needed as design changes. > > But I might want to add additional methods etc to the objects. Wouldn't that > code be lost in the regeneration? That sounds like it would be kind of a pain. > > Is that actually a problem in use of MiddleKit? > > John > > _______________________________________________ > Webware-discuss mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > |
From: John H. <jho...@to...> - 2002-01-10 00:50:33
|
OK, I've been thinking about this a bit - how does one use inheritance in this system? Can the CSV file declare an object is a subclass of another CSV-based object? On Wed, Jan 09, 2002 at 05:23:03PM -0600, Ian Bicking wrote: > Each MK object is composed of a generated portion, and a subclass that > you can customize. You'll notice the subclass (which is just > boilerplate) is very boring, and will not change as you change your > model, so you are safe. The superclass (named, I think, as *Gen) will > get overwritten, and you should not edit that code. I think MK places > those generated classes in a different directory. > > On Wed, 2002-01-09 at 17:09, John Holland wrote: > > I've been learning about MiddleKit today and something struck me as peculiar- > > > > the Quickstart says to design your objects in a CSV spreadsheet, and that it > > will then generate code. It also says that regenerating the code is often > > needed as design changes. > > > > But I might want to add additional methods etc to the objects. Wouldn't that > > code be lost in the regeneration? That sounds like it would be kind of a pain. > > > > Is that actually a problem in use of MiddleKit? > > > > John > > > > _______________________________________________ > > Webware-discuss mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/webware-discuss > > > > > > _______________________________________________ > Webware-discuss mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-discuss |
From: John H. <jho...@to...> - 2002-01-10 00:58:47
|
Doh! I just looked at the Quick Start again and saw how it does it. John On Wed, Jan 09, 2002 at 07:50:25PM -0500, John Holland wrote: > OK, I've been thinking about this a bit - how does one use inheritance > in this system? Can the CSV file declare an object is a subclass of > another CSV-based object? > > On Wed, Jan 09, 2002 at 05:23:03PM -0600, Ian Bicking wrote: > > Each MK object is composed of a generated portion, and a subclass that > > you can customize. You'll notice the subclass (which is just > > boilerplate) is very boring, and will not change as you change your > > model, so you are safe. The superclass (named, I think, as *Gen) will > > get overwritten, and you should not edit that code. I think MK places > > those generated classes in a different directory. > > > > On Wed, 2002-01-09 at 17:09, John Holland wrote: > > > I've been learning about MiddleKit today and something struck me as peculiar- > > > > > > the Quickstart says to design your objects in a CSV spreadsheet, and that it > > > will then generate code. It also says that regenerating the code is often > > > needed as design changes. > > > > > > But I might want to add additional methods etc to the objects. Wouldn't that > > > code be lost in the regeneration? That sounds like it would be kind of a pain. > > > > > > Is that actually a problem in use of MiddleKit? > > > > > > John > > > > > > _______________________________________________ > > > Webware-discuss mailing list > > > Web...@li... > > > https://lists.sourceforge.net/lists/listinfo/webware-discuss > > > > > > > > > > > _______________________________________________ > > Webware-discuss mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/webware-discuss > > _______________________________________________ > Webware-discuss mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-discuss |
From: John H. <jho...@to...> - 2002-01-09 17:00:59
|
I've just started looking at MiddleKit, using Webware 6.0 and the docs that come with it. I'm trying to do the tutorial bit with the Videos .csv file. when I run the generate.py, I get errors as shown below. Can anyone help me get past this? $ python ~jholland/Webware/MiddleKit/Design/Generate.py --db My SQL --model Videos Generating SQL... Traceback (most recent call last): File "/home/jholland/Webware/MiddleKit/Design/Generate.py", line 150, in ? Generate().main(sys.argv) File "/home/jholland/Webware/MiddleKit/Design/Generate.py", line 81, in main outdir=os.path.join(outdir, 'GeneratedSQL')) File "/home/jholland/Webware/MiddleKit/Design/Generate.py", line 146, in generate generator.generate(outdir) File "/home/jholland/Webware/MiddleKit/Design/SQLGenerator.py", line 59, in generate self._model.writeInsertSamplesSQL(self, dirname) File "/home/jholland/Webware/MiddleKit/Design/SQLGenerator.py", line 95, in writeInsertSamplesSQ L self.writeInsertSamplesSQLForLines(lines, generator, file) File "/home/jholland/Webware/MiddleKit/Design/SQLGenerator.py", line 113, in writeInsertSamplesS QLForLines klass = self.klass(tableName) File "/home/jholland/Webware/MiddleKit/Core/Model.py", line 69, in klass return self._klasses[name] File "/usr/local/lib/python2.1/UserDict.py", line 14, in __getitem__ def __getitem__(self, key): return self.data[key] KeyError: Thing |
From: Jason H. <ja...@pe...> - 2002-01-09 17:07:34
|
On Wed, 2002-01-09 at 11:00, John Holland wrote: > I've just started looking at MiddleKit, using Webware 6.0 and the docs that > come with it. I'm trying to do the tutorial bit with the Videos .csv file. > when I run the generate.py, I get errors as shown below. Can anyone help me > get past this? <snip> > return self._klasses[name] > File "/usr/local/lib/python2.1/UserDict.py", line 14, in __getitem__ > def __getitem__(self, key): return self.data[key] > KeyError: Thing I'm pretty sure that the problem lies in the Samples.csv file, because if you're using the one from MiddleKit/Resources/Template.mkmodel, it doesn't match up with the schema as described in the tutorial. You can either fix it or mv it out of the way, and then generate again. Cheers, Jason |