Exemplo n.º 1
0
Arquivo: cms.py Projeto: strogo/djpcms
 def clean(self, value):
     '''
     Overried default value to return a Content Type object
     '''
     name = super(PluginChoice,self).clean(value)
     value = get_plugin(name) 
     if not value:
         raise forms.ValidationError('%s not a plugin object' % name)
     return value
Exemplo n.º 2
0
 def default_post(self, djp):
     user = djp.request.user
     if user.is_authenticated() and user.is_active:
         provider = self.provider(djp)
         social = user.linked_accounts.filter(provider = str(provider))
         if social:
             social = social[0]
         else:
             return self.error_post('Could not authenticate user')
             
         name = '{0}/{1}'.format(provider,djp.getdata('action'))
         plugin = get_plugin(name)
         if not plugin:
             return self.error_post('Could not find plugin {0}'.format(name))
         api  = provider.authenticated_api(social.token,social.secret)
         return plugin.handle_post(djp, api, social)
Exemplo n.º 3
0
 def __get_plugin(self):
     return get_plugin(self.plugin_name)