Re: wordpress hooks and actions system in django?

2008-02-23 Thread Aaron Fay
I thought I would chime in here as well, having a good deal of code written
for WordPress, and now some experience with Django.

I had originally contemplated the same idea, create a plugin system like
that of WP until I started to understand the power of applications.  In my
mind it would be a terrible amount of work to create a system to read a
plugin's structure, handle permissions (if needed) and then be compatible
with the template system, when it's very simple to create an app to do
something pluggable (say a classifieds application).  The ease with which
you can build new features in django, and make them available to other
projects far outweighs any advantage I can think with some kind of plugin
system (just my opinion).  I try to write the applications for my project as
if they needed to be pluggable, as few dependancies as possible, etc.  And
as far as wp filters go, the signal system should be more than capable.

Do your need to provide the ability for another person to write 'plugins' or
functionality for django?  I'm thinking maybe there is something you know
how to do well in wordpress but aren't sure how it's done/available in
django?

Cheers,
Aaron

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wordpress hooks and actions system in django?

2008-02-22 Thread [EMAIL PROTECTED]

I had an idea about this, I would just like to say it is porbably un-
pythonic, scary, and completely untested, here goes:

Create a model for plugins, it should have a filefield and a few other
fields for meta data(these should not be editable), plus a boolean
field for enabled. Essentially what should happen is the file will
contain a class and some meta data that gives information about
itself.  When you upload the file it gets read to get the meta data
out(for example it might have a title, description, author, and some
way of telling your application what it expects for input).  This can
be done using the __import__ feautre of python, here is an example:
http://dpaste.com/36440/ in the .py file there should be a variable
with a generic name that is a copy of the class, that way the class
can be whatever you want, then each plugin's class just needs to
implement a generic interface, and a inner class with the meta info,
then when you want to use it you could do something like this:
http://dpaste.com/36442/

On Feb 22, 11:18 am, canen <[EMAIL PROTECTED]> wrote:
> Just chiming in here. There is a Wordpress 'clone' written in Python
> called Textpress [1]. It implements
> a lightweight events/actions system[2] akin to the one you mentioned.
>
> [1]http://textpress.pocoo.org/
> [2]http://dev.pocoo.org/projects/textpress/browser/textpress/application...
>
> On Feb 22, 11:27 am, Kyle Fox <[EMAIL PROTECTED]> wrote:
>
> > The part that I'm struggling to wrap my head around is how to make
> > plugins "installable".
>
> > I think one of the reasons Wordpress's plugin framework is so
> > successful is how easy it is to manage your plugins: install /
> > uninstall buttons on a page means the user doesn't have to write any
> > glue code or even do anything from the command line.
>
> > I guess you could have an empty 'plugins' app somewhere, and simply
> > drop py files into it for each plugin.  What are your guys' thoughts
> > on how to accomplish this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wordpress hooks and actions system in django?

2008-02-22 Thread canen

Just chiming in here. There is a Wordpress 'clone' written in Python
called Textpress [1]. It implements
a lightweight events/actions system[2] akin to the one you mentioned.


[1] http://textpress.pocoo.org/
[2] 
http://dev.pocoo.org/projects/textpress/browser/textpress/application.py#L271

On Feb 22, 11:27 am, Kyle Fox <[EMAIL PROTECTED]> wrote:
> The part that I'm struggling to wrap my head around is how to make
> plugins "installable".
>
> I think one of the reasons Wordpress's plugin framework is so
> successful is how easy it is to manage your plugins: install /
> uninstall buttons on a page means the user doesn't have to write any
> glue code or even do anything from the command line.
>
> I guess you could have an empty 'plugins' app somewhere, and simply
> drop py files into it for each plugin.  What are your guys' thoughts
> on how to accomplish this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wordpress hooks and actions system in django?

2008-02-22 Thread Kyle Fox

The part that I'm struggling to wrap my head around is how to make
plugins "installable".

I think one of the reasons Wordpress's plugin framework is so
successful is how easy it is to manage your plugins: install /
uninstall buttons on a page means the user doesn't have to write any
glue code or even do anything from the command line.

I guess you could have an empty 'plugins' app somewhere, and simply
drop py files into it for each plugin.  What are your guys' thoughts
on how to accomplish this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wordpress hooks and actions system in django?

2008-02-21 Thread Marty Alchin

While not exactly Django-specific, I wrote up an article[1] last
month, describing an easy way to enable plugins in any Python
application. I don't know if that's what you're looking for, but it's
probably worth a look, anyway.

-Gul

[1] http://gulopine.gamemusic.org/2008/jan/10/simple-plugin-framework/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wordpress hooks and actions system in django?

2008-02-21 Thread Dj Gilcrease

On Thu, Feb 21, 2008 at 9:13 AM, Bram - Smartelectronix
<[EMAIL PROTECTED]> wrote:
>  I was looking at that before, but... aren't django signals mostly for
>  one-sided communication? I.e. I signal something, someone else catches
>  it and does something.
>
>  In wordpress it's very much 2-sided communication...


2 sided as in the hook gets the info back from the plugin?

Djangos Dispatcher does this, the sender gets the results back from
the receiver. I do not believe Django makes use of this anywhere (but
have not checked to be sure)

To write a plugin manager in your case you would have to write your
own sender, so that each consecutive plugin listening to a particular
signal, got the results from the previous plugin not the unmodified
results

Totally Untested example based on the webcast you linked to (
http://dpaste.com/36295/ )

The majority of your work would come in creating the signals, and what
each signal should contain and where it should be sent from

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wordpress hooks and actions system in django?

2008-02-21 Thread Bram - Smartelectronix

Dj Gilcrease wrote:
> On Thu, Feb 21, 2008 at 6:23 AM, Bram - Smartelectronix
> <[EMAIL PROTECTED]> wrote:
>>  Basically plugins can register with the host app and say "I want to be
>>  plugged in here or there" (the hook). The host app in various places has
>>  calls which "apply" whatever is hooked into that location.
>>
>>
>>  If anyone has any ideas or pointers as to how this could be done, please
>>  let me know.
> 
> This sounds like a good application for the Dispatcher in Django (
> http://code.djangoproject.com/wiki/Signals )
> You write your own signals, that the plugins will listen for, they
> manipulate the data they need and the dispatcher returns all the
> responses.

I was looking at that before, but... aren't django signals mostly for 
one-sided communication? I.e. I signal something, someone else catches 
it and does something.

In wordpress it's very much 2-sided communication...

  - bram

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wordpress hooks and actions system in django?

2008-02-21 Thread Dj Gilcrease

On Thu, Feb 21, 2008 at 6:23 AM, Bram - Smartelectronix
<[EMAIL PROTECTED]> wrote:
>  Basically plugins can register with the host app and say "I want to be
>  plugged in here or there" (the hook). The host app in various places has
>  calls which "apply" whatever is hooked into that location.
>
>
>  If anyone has any ideas or pointers as to how this could be done, please
>  let me know.

This sounds like a good application for the Dispatcher in Django (
http://code.djangoproject.com/wiki/Signals )
You write your own signals, that the plugins will listen for, they
manipulate the data they need and the dispatcher returns all the
responses.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---