Hi,
I'm currently implementing a tool for auto-generating webforms from a
desription file. The output should become a php-script, an asp-script,
zope-formulator or such. Each if it may (or may not) have javascript
additions. The output format should be defined ar runtime (php,
php+javascrip, asp, asp+javascript, etc.).
Currently I have a fixed class hierarchy:
generic : implements generic html widgets (input, radiobuttons)
php : "mixin" for adding php-specifi code to the widget,
eg. getting values from HTTP_POST_VARS/_POST
javascript : adds javascript scripts, eg. error checking
Obviously this does not scale as soon as I add more mid-layers (asp,
psp, etc.).
For me this sounds like I could benefit from using metaclasses here.
Before I start implementing such a beast, I want to be shure, there will
be a benefit.
Any suggestions?
--
Schönen Gruß - Regards
Hartmut Goebel
| Hartmut Goebel | IT-Security -- effizient |
| h.******@goebel-consult.de | www.goebel-consult.de | 1 1338
Hartmut Goebel <h.******@goebe l-consult.de> wrote in message news:<41******* *************** @newsread2.arco r-online.net>... Hi,
I'm currently implementing a tool for auto-generating webforms from a desription file. The output should become a php-script, an asp-script, zope-formulator or such. Each if it may (or may not) have javascript additions. The output format should be defined ar runtime (php, php+javascrip, asp, asp+javascript, etc.).
Currently I have a fixed class hierarchy:
generic : implements generic html widgets (input, radiobuttons) php : "mixin" for adding php-specifi code to the widget, eg. getting values from HTTP_POST_VARS/_POST javascript : adds javascript scripts, eg. error checking
Obviously this does not scale as soon as I add more mid-layers (asp, psp, etc.).
For me this sounds like I could benefit from using metaclasses here. Before I start implementing such a beast, I want to be shure, there will be a benefit.
Any suggestions?
Metaclasses are essentially syntactic sugar. You can do more or less
everything without them. For instance you can use a poor man function
to
format your classes as you wish. Then, you have to apply the function
to the every subclass by hand. If you use a metaclass, subclasses are
automatically reformatted, instead. So, using a function means
a bit more typing but greater expliciteness. Metaclasses are okay
if you want to hide to your users the fact that something magic is
going on.
Michele Simionato This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stephan Diehl |
last post by:
I have a question about metaclasses:
How would be the best way to "merge" different metaclasses?
Or, more precisely, what is the best way to merge metaclass functionality?
The idea is basicly the following:
One has several (metaclass) modules that implements an interesting feature.
Lets say, I have a metaclass L, that adds logging capabilities to all method
calls and another one, called P, that creates properties on the fly.
|
by: Mike C. Fletcher |
last post by:
Slides from my PyGTA presentation on Tuesday, focusing mostly on
why/where you would want to use meta-classes, are available in PDF format:
http://members.rogers.com/mcfletch/programming/metaclasses.pdf
BTW, for those not on Python-list, be sure to check out David &
Michele's newest developerworks article on the topic:
http://www.ibm.com/developerworks/library/l-pymeta.html...
|
by: Santiago Aguiar |
last post by:
Im trying to use AOP techniques on python but, even if I understand
the idea behind metaclasses, I cant find a way to use AOP in a dynamic
way.
What im trying to do is to weave an aspect to a class at runtime, but
i don't want to include any special code or definition in the class
itself. Also, i want to do
it just for some particular classes. Is there any way to do this?
I know its possible to apply an aspect to all the classes by
|
by: Michael Sparks |
last post by:
Anyway...
At Europython Guido discussed with everyone the outstanding issue with
decorators and there was a clear majority in favour of having them, which
was good. From where I was sitting it looked like about 20:20 split on the
following syntaxes:
1 def func(arg1, arg2, arg3) :
function...
2 def func(arg1, arg2, arg3):
function...
|
by: Jean-François Doyon |
last post by:
Hello,
I'm using MetaClasses to create classes.
How do I make these new classes "globally" available?
I probably just have to assign them to something magic, but I can't seem to
figure out which one.
if I do:
| |
by: Paul Morrow |
last post by:
....that they warrant an entirely new syntax? It seems that they are
very similar in a very significant way --- they alter the default
behavior of something. IMO, it's not a stretch to say that they
'parallel' metaclasses; that they are to functions/methods what
metaclasses are to classes. So why don't they share a similar syntax?
class Foo:
""" This is the docstring for class Foo. """
__metaclass__ = M
# body of class goes here
|
by: Steffen Glückselig |
last post by:
Hello,
I've been experimenting with metaclasses a bit (even though I am quite
a newbie to python) and stumpled over the following problem in my code:
class Meta(type):
def __init__(cls, name, bases, dct):
for attr, value in dct.items():
if callable(value):
dct = wrapper(value)
|
by: Jan-Ole Esleben |
last post by:
Hi!
I've just posted a question about metaclasses in ZOPE on the ZOPE
list, and one of the replies said that metaclasses (at least
"painless" metaclasses) cannot be used without new-style classes (or
rather, that they don't work where you cannot explicitly use new-style
classes). I haven't so far been able to find _anything_ on the subject
- what is true here?
TIA,
|
by: Alan Isaac |
last post by:
Forman's book is out of print.
Is there a good substitute?
Thanks,
Alan Isaac
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |