Browse Source

Flask/Jinja2 doesn't support properties somehow.

sh4nks 11 years ago
parent
commit
91f065fa98
2 changed files with 25 additions and 20 deletions
  1. 14 14
      flaskbb/plugins/__init__.py
  2. 11 6
      flaskbb/plugins/example/__init__.py

+ 14 - 14
flaskbb/plugins/__init__.py

@@ -24,20 +24,20 @@ class Plugin(object):
     #: in here.
     #: in here.
     models = []
     models = []
 
 
-    @property
-    def name(self):
-        """If not overridden, it will use the classname as the plugin name."""
-        return self.__class__.__name__
-
-    @property
-    def description(self):
-        """Returns a small description of the plugin."""
-        return ""
-
-    @property
-    def version(self):
-        """Returns the version of the plugin"""
-        return "0.0.0"
+    #: The plugin name
+    name = None
+
+    #: The author of the plugin
+    author = None
+
+    #: The license of the plugin
+    license = None
+
+    #: A small description of the plugin.
+    description = None
+
+    #: The version of the plugin"""
+    version = "0.0.0"
 
 
     def enable(self):
     def enable(self):
         """Enable the plugin."""
         """Enable the plugin."""

+ 11 - 6
flaskbb/plugins/example/__init__.py

@@ -2,6 +2,7 @@ from flask import flash
 from flaskbb.plugins import Plugin, hooks
 from flaskbb.plugins import Plugin, hooks
 
 
 #: The name of your plugin class
 #: The name of your plugin class
+__version__ = "1.0.0"
 __plugin__ = "ExamplePlugin"
 __plugin__ = "ExamplePlugin"
 
 
 
 
@@ -14,13 +15,17 @@ def inject_hello_world():
 
 
 
 
 class ExamplePlugin(Plugin):
 class ExamplePlugin(Plugin):
-    @property
-    def description(self):
-        return "Example plugin"
 
 
-    @property
-    def version(self):
-        return "1.0.0"
+    name = "Example Plugin"
+
+    description = ("This plugin gives a quick insight on how you can write "
+                   "plugins in FlaskBB.")
+
+    author = "sh4nks"
+
+    license = "BSD License. See LICENSE file for more information."
+
+    version = __version__
 
 
     def enable(self):
     def enable(self):
         hooks.add("beforeIndex", hello_world)
         hooks.add("beforeIndex", hello_world)