Here is setup.py:

from reviewboard.extensions.packaging import setup

setup( name='sapauth',
       version='1.0',
       description='SAP Authentication backend for sareviews',
       author='Graeme Perrow',
       packages=['sapauth'],
       entry_points={
          'reviewboard.extensions': [
              'sapauth = sapauth:SAPExtension',
          ],
      }
)


And sapauth/__init__.py (with much of the code removed):

import sys,urllib2,xml.sax
import logging
from django.conf import settings
from django.contrib.auth.models import User
from djblets.db.query import get_object_or_none

from reviewboard.accounts.backends import AuthBackend
from reviewboard.extensions.base import Extension
from reviewboard.extensions.hooks import AuthBackendHook

class sapauth(AuthBackend):
    name = 'SAP'
    backend_id = 'SAP_Auth_1.0'
    supports_registration = False
    supports_change_name = False
    supports_change_email = False
    supports_change_password = False

    def authenticate(self, username, password):
        ...
    #

    def get_user( self, user_id ):
        return get_object_or_none(User, pk=user_id)
    #
    
    def get_or_create_user(self, username, handler=None):
        ...
#

class SAPExtension(Extension):
    def initialize(self):
        AuthBackendHook(self, sapauth)
#



On Tuesday, 3 November 2015 16:29:55 UTC-5, Christian Hammond wrote:
>
> Hi,
>
> I'd have to see the source of the extension to really be able to tell you 
> more, but it sounds like perhaps the extension or its registration (in 
> setup.py) isn't using absolute module paths to refer to some module.
>
> Would you be able to show me how you're registering it in setup.py, and 
> the class attributes for your extension?
>
> Thanks,
>
> Christian
>
> -- 
> Christian Hammond - chri...@beanbaginc.com <javascript:>
> Review Board - https://www.reviewboard.org
> Beanbag, Inc. - https://www.beanbaginc.com
>
> On Tue, Nov 3, 2015 at 12:23 PM, Graeme Perrow <graeme...@gmail.com 
> <javascript:>> wrote:
>
>> I am trying to create an authentication extension for reviewboard 
>> (running 2.0.18). I've followed the authentication backend instructions 
>> here 
>> <https://www.reviewboard.org/docs/manual/2.0/extending/auth-backends/#authentication-classes>
>>  and 
>> the installation instructions here 
>> <https://www.reviewboard.org/docs/manual/2.0/extending/extensions/distribution/#python-egg>.
>>  
>> But I'm obviously missing something. My extension shows up in the list of 
>> available extensions, but attempting to enable it results in a "Loading..." 
>> message that never goes away.
>>
>> If I look in the log file (specified in the Logging admin page), I see 
>> this exception:
>>
>> relative imports require the 'package' argument
>> Traceback (most recent call last):
>>   File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", 
>> line 112, in get_response
>>     response = wrapped_callback(request, *callback_args, 
>> **callback_kwargs)
>>   File 
>> "/usr/lib/python2.7/site-packages/django/views/decorators/cache.py", line 
>> 52, in _wrapped_view_func
>>     response = view_func(request, *args, **kwargs)
>>   File 
>> "/usr/lib/python2.7/site-packages/django/views/decorators/vary.py", line 
>> 19, in inner_func
>>     response = func(*args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources.py", 
>> line 497, in __call__
>>     request, method, view, api_format=api_format, *args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources.py", 
>> line 568, in call_method_view
>>     return view(request, *args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources.py", 
>> line 765, in put
>>     return self.update(request, *args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>> line 117, in _call
>>     return view_func(*args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>> line 138, in _checklogin
>>     return view_func(*args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>> line 117, in _call
>>     return view_func(*args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>> line 164, in _checkpermissions
>>     response = view_func(*args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>> line 117, in _call
>>     return view_func(*args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>> line 117, in _call
>>     return view_func(*args, **kwargs)
>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>> line 287, in _validate
>>     return view_func(*args, **new_kwargs)
>>   File 
>> "/usr/lib/python2.7/site-packages/djblets/extensions/resources.py", line 
>> 211, in update
>>     self._extension_manager.enable_extension(extension_id)
>>   File "/usr/lib/python2.7/site-packages/djblets/extensions/manager.py", 
>> line 310, in enable_extension
>>     extension = self._init_extension(ext_class)
>>   File "/usr/lib/python2.7/site-packages/djblets/extensions/manager.py", 
>> line 608, in _init_extension
>>     self._reset_templatetags_cache()
>>   File "/usr/lib/python2.7/site-packages/djblets/extensions/manager.py", 
>> line 667, in _reset_templatetags_cache
>>     get_templatetags_modules()
>>   File "/usr/lib/python2.7/site-packages/django/template/base.py", line 
>> 1292, in get_templatetags_modules
>>     import_module(templatetag_module)
>>   File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 
>> 33, in import_module
>>     raise TypeError("relative imports require the 'package' argument")
>> TypeError: relative imports require the 'package' argument
>>
>> My actual extension is not listed in the call stack. What am I missing?
>>
>>
>> -- 
>> Supercharge your Review Board with Power Pack: 
>> https://www.reviewboard.org/powerpack/
>> Want us to host Review Board for you? Check out RBCommons: 
>> https://rbcommons.com/
>> Happy user? Let us know! https://www.reviewboard.org/users/
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "reviewboard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to reviewboard...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to