def create_bundle(self, metric_name, source_name, plugin, cls): if issubclass(cls, PluginDataModel): factory = PluginDataFactory else: raise Exception("Invalid class type for factory.") metric = MetricFactory(name=metric_name) source = SourceFactory(name=source_name) model = PluginModelFactory() cls_args = dict(metric=metric, source=source, plugin=plugin, plugin_model=model) inst = factory(**cls_args) cls_args.update({ 'source_proxy': SourceProxy(name=source.name), 'metric_proxy': MetricProxy(name=metric.name), 'plugin_proxy': PluginProxy(name=plugin.name, hashkey=plugin.hashkey), 'plugin_model_proxy': PluginModelProxy(metric_id=metric.name, plugin_id=plugin.hashkey, hashkey=model.hashkey, name=model.__class__.__name__), 'inst': inst }) return cls_args
class MoodForm(FormView): name = "mood" description = "Please enter some information about your mood." model = MoodModel metric_proxy = MetricProxy(name="mood") source_proxy = SourceProxy(name="self") score = IntegerField('Mood', [required()], description="Number on a 1-10 scale.")
class SurveyForm(FormView): name = "survey" description = "Please enter some long information about your mood." model = DataModel metric_proxy = MetricProxy(name="data") source_proxy = SourceProxy(name="self") text = TextField(description="Enter the mood you are feeling.") number = IntegerField(description="Number on a 1-10 scale.")
class MoodModel(PluginDataModel): metric_proxy = MetricProxy(name="mood") source_proxy = SourceProxy(name="self") perms = [ Scope(ZonePerm("user", current=True), BlockPerm("plugin", current=True)) ] score = IntegerField()
class SettingsModel(PluginDataModel): metric_proxy = MetricProxy(name="settings") source_proxy = SourceProxy(name="self") perms = [ Scope(ZonePerm("user", current=True), BlockPerm("plugin", current=True)) ] your_name = Field()
class DataModel(PluginDataModel): metric_proxy = MetricProxy(name="data") source_proxy = SourceProxy(name="self") perms = [ Scope(ZonePerm("user", current=True), BlockPerm("plugin", current=True)) ] number = Field() text = Field()
class Checkins(PluginDataModel): metric_proxy = MetricProxy(name="checkins") source_proxy = SourceProxy(name="foursquare") perms = [Scope(ZonePerm("user", current=True), BlockPerm("plugin", all=True))] type = Field() source = Field() venue = Field() location = DictField() latitude = Field() longitude = Field() visit_count = FloatField() date = DateTimeField
class NewsFeed(PluginDataModel): metric_proxy = MetricProxy(name="newsfeed") source_proxy = SourceProxy(name="facebook") perms = [ Scope(ZonePerm("user", current=True), BlockPerm("plugin", all=True)) ] date = DateTimeField() update_time = DateTimeField() from_id = Field() from_name = Field() story = Field() type = Field() likes = ListField() comments = ListField() message = Field() name = Field() shares = IntegerField() picture = Field()
class BaseFitbitModel(PluginDataModel): metric_proxy = MetricProxy(name="newsfeed") source_proxy = SourceProxy(name="fitbit") date = DateTimeField() value = FloatField()
class SettingsModel(PluginDataModel): metric_proxy = MetricProxy(name="settings") source_proxy = SourceProxy(name="self") name = Field()
class TestModel(PluginDataModel): metric_proxy = MetricProxy(name="test1") source_proxy = SourceProxy(name='test1') number = IntegerField()
class TestLoosePermissions(PluginDataModel): metric_proxy = MetricProxy(name="test2") source_proxy = SourceProxy(name="test2") perms = [Scope(ZonePerm("user", all=True), BlockPerm("plugin", all=True))]