Code Monkey home page Code Monkey logo

apex's People

Contributors

cd34 avatar delijati avatar georgevreilly avatar jf-parent avatar kiorky avatar kkszysiu avatar nathanielbaxter avatar neogenix avatar qwait avatar sontek avatar tignas avatar tilgovi avatar timgates42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apex's Issues

Quickstart example fails on Mavericks 10.9.2, Python 2.7.5

When following the quickstart instructions here:

http://thesoftwarestudio.com/apex/QUICKSTART.html

The pcreate -s alchemy call fails with:

pkg_resources.DistributionNotFound: pyramid==1.5a2

Full log here:


(env:)
export CPPFLAGS=-Qunused-arguments
export CFLAGS=-Qunused-arguments



hannam@wsin706:~/src/py(master⚡) » virtualenv apex_env
New python executable in apex_env/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
hannam@wsin706:~/src/py(master⚡) » cd apex_
cd:cd:13: no such file or directory: apex_
hannam@wsin706:~/src/py(master⚡) » cd apex_env                                                                                 1 ↵
hannam@wsin706:~/src/py/apex_env(master⚡) » bin/easy_install apex
Searching for apex
Reading https://pypi.python.org/simple/apex/
Best match: apex 0.9.10dev
Downloading https://pypi.python.org/packages/source/a/apex/apex-0.9.10dev.tar.gz#md5=8c838c69a1e84c9e8c1feebb8d8e2952
Processing apex-0.9.10dev.tar.gz
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-oLqzaE/apex-0.9.10dev/setup.cfg
Running apex-0.9.10dev/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-oLqzaE/apex-0.9.10dev/egg-dist-tmp-BWHTHt
Adding apex 0.9.10dev to easy-install.pth file

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/apex-0.9.10dev-py2.7.egg
Processing dependencies for apex
Searching for wtforms-recaptcha
Reading https://pypi.python.org/simple/wtforms-recaptcha/
Best match: wtforms-recaptcha 0.3.1
Downloading https://pypi.python.org/packages/source/w/wtforms-recaptcha/wtforms-recaptcha-0.3.1.tar.gz#md5=6d21aecadbb1e1affa3316e824bd9966
Processing wtforms-recaptcha-0.3.1.tar.gz
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-ulKI2G/wtforms-recaptcha-0.3.1/setup.cfg
Running wtforms-recaptcha-0.3.1/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-ulKI2G/wtforms-recaptcha-0.3.1/egg-dist-tmp-_AogAA
warning: no previously-included files matching '*.pyc' found under directory 'tests'
zip_safe flag not set; analyzing archive contents...
Adding wtforms-recaptcha 0.3.1 to easy-install.pth file

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/wtforms_recaptcha-0.3.1-py2.7.egg
Searching for wtforms
Reading https://pypi.python.org/simple/wtforms/
Best match: WTForms 1.0.5
Downloading https://pypi.python.org/packages/source/W/WTForms/WTForms-1.0.5.zip#md5=a7ba0af8ed65267e5b421d34940d0151
Processing WTForms-1.0.5.zip
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-hAvRuj/WTForms-1.0.5/setup.cfg
Running WTForms-1.0.5/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-hAvRuj/WTForms-1.0.5/egg-dist-tmp-8iuvBU
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
zip_safe flag not set; analyzing archive contents...
wtforms.ext.i18n.utils: module references __file__
Adding WTForms 1.0.5 to easy-install.pth file

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/WTForms-1.0.5-py2.7.egg
Searching for requests
Reading https://pypi.python.org/simple/requests/
Best match: requests 2.2.1
Downloading https://pypi.python.org/packages/source/r/requests/requests-2.2.1.tar.gz#md5=ac27081135f58d1a43e4fb38258d6f4e
Processing requests-2.2.1.tar.gz
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-kuI_8g/requests-2.2.1/setup.cfg
Running requests-2.2.1/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-kuI_8g/requests-2.2.1/egg-dist-tmp-xhusyj
Adding requests 2.2.1 to easy-install.pth file

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/requests-2.2.1-py2.7.egg
Searching for pyramid-mailer
Reading https://pypi.python.org/simple/pyramid_mailer/
Best match: pyramid-mailer 0.13
Downloading https://pypi.python.org/packages/source/p/pyramid_mailer/pyramid_mailer-0.13.tar.gz#md5=43800c7c894097a23140da58e3638c93
Processing pyramid_mailer-0.13.tar.gz
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-eq3FN7/pyramid_mailer-0.13/setup.cfg
Running pyramid_mailer-0.13/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-eq3FN7/pyramid_mailer-0.13/egg-dist-tmp-JVTje2
Adding pyramid-mailer 0.13 to easy-install.pth file

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/pyramid_mailer-0.13-py2.7.egg
Searching for pyramid>1.1.2
Reading https://pypi.python.org/simple/pyramid/
Best match: pyramid 1.5
Downloading https://pypi.python.org/packages/source/p/pyramid/pyramid-1.5.tar.gz#md5=8747658dcbab709a9c491e43d3b0d58b
Processing pyramid-1.5.tar.gz
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-x4ErOW/pyramid-1.5/setup.cfg
Running pyramid-1.5/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-x4ErOW/pyramid-1.5/egg-dist-tmp-NKchsb
Adding pyramid 1.5 to easy-install.pth file
Installing ptweens script to /Users/hannam/src/py/apex_env/bin
Installing pdistreport script to /Users/hannam/src/py/apex_env/bin
Installing proutes script to /Users/hannam/src/py/apex_env/bin
Installing pshell script to /Users/hannam/src/py/apex_env/bin
Installing prequest script to /Users/hannam/src/py/apex_env/bin
Installing pviews script to /Users/hannam/src/py/apex_env/bin
Installing pcreate script to /Users/hannam/src/py/apex_env/bin
Installing pserve script to /Users/hannam/src/py/apex_env/bin

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/pyramid-1.5-py2.7.egg
Searching for velruse>=1.0.3
Reading https://pypi.python.org/simple/velruse/
Best match: velruse 1.1.1
Downloading https://pypi.python.org/packages/source/v/velruse/velruse-1.1.1.tar.gz#md5=40cc41048817e248d9292933be194eeb
Processing velruse-1.1.1.tar.gz
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-DE91Iy/velruse-1.1.1/setup.cfg
Running velruse-1.1.1/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-DE91Iy/velruse-1.1.1/egg-dist-tmp-xek6hk
Adding velruse 1.1.1 to easy-install.pth file

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/velruse-1.1.1-py2.7.egg
Searching for zope.sqlalchemy
Reading https://pypi.python.org/simple/zope.sqlalchemy/
Best match: zope.sqlalchemy 0.7.4
Downloading https://pypi.python.org/packages/source/z/zope.sqlalchemy/zope.sqlalchemy-0.7.4.zip#md5=87758437ec5584a14ed801233b2f348f
Processing zope.sqlalchemy-0.7.4.zip
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-Q69Qcl/zope.sqlalchemy-0.7.4/setup.cfg
Running zope.sqlalchemy-0.7.4/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-Q69Qcl/zope.sqlalchemy-0.7.4/egg-dist-tmp-plqfcm
Adding zope.sqlalchemy 0.7.4 to easy-install.pth file

Installed /Users/hannam/src/py/apex_env/lib/python2.7/site-packages/zope.sqlalchemy-0.7.4-py2.7.egg
Searching for cryptacular
Reading https://pypi.python.org/simple/cryptacular/
Best match: cryptacular 1.4.1
Downloading https://pypi.python.org/packages/source/c/cryptacular/cryptacular-1.4.1.tar.gz#md5=fe12232ac660185186dd8057d8ca7b0e
Processing cryptacular-1.4.1.tar.gz
Writing /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-u12ZcK/cryptacular-1.4.1/setup.cfg
Running cryptacular-1.4.1/setup.py -q bdist_egg --dist-dir /var/folders/j5/_f_f0ny576b3zg83w93z1rmc4n9s9r/T/easy_install-u12ZcK/cryptacular-1.4.1/egg-dist-tmp-69uPPR
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: Setup script exited with error: command 'cc' failed with exit status 1
hannam@wsin706:~/src/py/apex_env(master⚡) » ls                                                                                 1 ↵
bin     include lib
hannam@wsin706:~/src/py/apex_env(master⚡) » cd bin
hannam@wsin706:~/src/py/apex_env/bin(master⚡) » ls
activate         activate_this.py pcreate          pip-2.7          pserve           pviews           python2.7
activate.csh     easy_install     pdistreport      prequest         pshell           python
activate.fish    easy_install-2.7 pip              proutes          ptweens          python2
hannam@wsin706:~/src/py/apex_env/bin(master⚡) » cd ..                
hannam@wsin706:~/src/py/apex_env(master⚡) » pcreate -s alchemy example
Traceback (most recent call last):
  File "/usr/local/bin/pcreate", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2716, in <module>

  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 685, in require
    def __getstate__(self):
  File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 588, in resolve
    The `plugin_env` should be an ``Environment`` instance that contains
pkg_resources.DistributionNotFound: pyramid==1.5a2

Tried to run the apex example and ran into the following problem

used virtualenv, and installed velruse

When tried to run pserve development.ini, I got this message, can post the rest of the stack trace if needed but here is the bottom part.

File "build/bdist.linux-i686/egg/sqlalchemy/engine/init.py", line 321, in create_engine
File "build/bdist.linux-i686/egg/sqlalchemy/engine/strategies.py", line 141, in create
TypeError: Invalid argument(s) 'pool_size' sent to create_engine(), using configuration SQLiteDialect_pysqlite/NullPool/Engine. Please check that the keyword arguments are appropriate for this combination of components.; got ({'__file...le'}, beaker.session.cookie_domain=..., beaker.session.data_dir=..., beaker.session.key=..., beaker.session.lock_dir=..., beaker.session.secret=..., beaker.session.type=..., beaker.session.validate_key=..., config_file=...), wanted (global_conf, config_file, **app_conf)

What am I doing wrong?

Facebook auth gives KeyError

Hi,

I've tried to set up the example app, simply adding some properly set up facebook api credentials to the config yaml file. But authentication fails (actually, it might happen that authentication was successful, as the resulting view is not shown)

URL: http://localhost:6543/auth/apex_callback?csrf_token=b7727b98b2eecdd7d4b9bb53ec9e6aeac744527b&came_from=http://localhost:6543/protected
File '/home/akasha/.virtualenvs/pyramid/local/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/evalexception.py', line 431 in respond
  app_iter = self.application(environ, detect_start_response)
File '/home/akasha/.virtualenvs/pyramid/local/lib/python2.7/site-packages/repoze.tm2-1.0b2-py2.7.egg/repoze/tm/__init__.py', line 24 in __call__
  result = self.application(environ, save_status_and_headers)
File '/home/akasha/.virtualenvs/pyramid/local/lib/python2.7/site-packages/pyramid-1.2a3-py2.7.egg/pyramid/router.py', line 176 in __call__
  response = self.handle_request(request)
File '/home/akasha/.virtualenvs/pyramid/local/lib/python2.7/site-packages/pyramid-1.2a3-py2.7.egg/pyramid/tweens.py', line 34 in excview_tween
  response = view_callable(exc, request)
File '/home/akasha/.virtualenvs/pyramid/local/lib/python2.7/site-packages/pyramid-1.2a3-py2.7.egg/pyramid/config/views.py', line 319 in viewresult_to_response
  result = view(context, request)
File '/home/akasha/.virtualenvs/pyramid/local/lib/python2.7/site-packages/pyramid-1.2a3-py2.7.egg/pyramid/config/views.py', line 402 in _requestonly_view
  response = view(request)
File '/home/akasha/versioning/git/pyramid_apex/apex/views.py', line 352 in forbidden
  return Response(request.environ['repoze.bfg.message'])
KeyError: 'repoze.bfg.message'

apexid not set

hi,

I'm trying to get apex running with openid from localhost.

it seems that velrose logs me in, at least I get the flash message + velrose_key_storage is populated with a new record. Still, no new user is created in the system.

AFAIS, the problem is somewhere around line

auth = apexid_from_token(request.POST['token'])
if auth:
    user = AuthUser.get_by_login(auth['apexid'])

where auth variable is populated with many keys, but apexid:

{'apexid': None,
 u'profile': {...},
 u'status': u'ok'}

Ignores 'profile details' coming from twitter(or any other provider) after login

I'm using apex along with velruse, here is the pyramid's configuration.ini file for velruse.

[app:velruse]
use = egg:velruse
endpoint = http://myapp.com/auth/apex_callback
openid.store = openid.store.memstore:MemoryStore

When I looked into 'apex_callback', it in-turn calls 'apex_id_from_token' to get profile info using '/velruse/auth_info' url. Refer:https://github.com/cd34/apex/blob/master/apex/lib/libapex.py#L82

This function only extracts 'userid' and 'domian' fields from profile, ignoring other fields.
I can extract all other fields and return it. But it isn't a right way to do it.Is there better way to handle this scenario? With this info, we can auto-fill some of the fields in user profile.

Thanks in advance..

"HTTPForbidden: CSRF token is missing or invalid" after successful facebook authentication

I am using velruse 1.0.3.
After I successfully login to my facebook account, and velruse post the FacebookAuthenticationComplete data to the endpoint. I got a 302 "HTTPForbidden: CSRF token is missing or invalid" which is found by debugging into /site-packages/pyramid-1.3.4-py2.6.egg/pyramid/tweens.py:

The fix is simple:
in the development.ini
change
apex.no_csrf = apex:apex_callback
to:
apex.no_csrf = apex_callback

The QUICKSTART.rst is using "apex.no_csrf = apex:apex_callback", the INSTALL.rst is using "apex.no_csrf = apex_callback"

Quickstart velruse not working

when I click on the facebook button, the post action url is http://127.0.0.1:8080/velruse/login/facebook which returns a " 404 Not Found The resource could not be found. /login/facebook"

i'm using velruse-1.0.3.

it seems there's something wrong with my seeting? any solution ? Thank you!!!

my development.ini

[app:apex_example]
use = egg:apex_example
reload_templates = true
debug_authorization = false
debug_notfound = false
debug_routematch = false
debug_templates = true
default_locale_name = en
sqlalchemy.url = sqlite:///%(here)s/apex_example.db

mako.directories = apex_example:templates

apex.session_secret = apex_example_session_secret
apex.auth_secret = apex_example_auth_secret
apex.velruse_providers = facebook,
apex.came_from_route = home

[app:velruse]
use = egg:velruse
endpoint = http://domain.com/auth/apex_callback
openid.store = openid.store.memstore:MemoryStore
openid.realm = http://domain.com/

providers =
providers.facebook

facebook.consumer_key = xxx
facebook.consumer_secret = xxx

[filter:exc]
use=egg:WebError#evalerror

[pipeline:papex_example]
pipeline = exc tm apex_example

[composite:main]
use = egg:Paste#urlmap
/ = papex_example
/velruse = velruse

[filter:tm]
use = egg:repoze.tm2#tm
commit_veto = repoze.tm:default_commit_veto

[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 8080

Begin logging configuration

[loggers]
keys = root, apex_example, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_apex_example]
level = DEBUG
handlers =
qualname = apex_example

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine

"level = INFO" logs SQL queries.

"level = DEBUG" logs SQL queries and results.

"level = WARN" logs neither. (Recommended for production systems.)

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

End logging configuration

Valruse vs Apex callbacks

I cannot get Varluse to work with Apex. At the moment I try to make it work with Facebook, with the form callback set to apex_callback. But I think I found where the problem is, it is apex_callback and what verluse asks for in a form.

The problem I think is in those files
https://github.com/bbangert/velruse/blob/master/velruse/providers/facebook.py
https://github.com/cd34/apex/blob/master/apex/views.py

The apex_callback assumes the token is already in the reply from facebook, whereas Velruse in its callback makes a request to FB for the token.

apex_callbackwill not do anything if token is not in request.POST, which by default is not

def apex_callback(request):
    """ apex_callback(request):
    no return value, called with route_url('apex_callback', request)
    This is the URL that Velruse returns an OpenID request to
    """
    redir = request.GET.get('came_from', \
                route_url(apex_settings('came_from_route'), request))
    headers = []
    if 'token' in request.POST:
        auth = None

Velruse callback after checkinf csfr and code got from the initial request will ask for token, which apex_callback does not do.

 # Now retrieve the access token with the code
        access_url = flat_url(
            'https://graph.facebook.com/oauth/access_token',
            client_id=self.consumer_key,
            client_secret=self.consumer_secret,
            redirect_uri=request.route_url(self.callback_route),
            code=code)
        r = requests.get(access_url)

Am I right or am I missing something?

Just a note, I am trying to integrate Velruse and Apex with my app not to run Velruse as a service.

The "locale" folder is missing in egg

Hi,
I want to use apex and have followed the tutorial to use apex here:

http://thesoftwarestudio.com/apex/QUICKSTART.html

But somehow, when I try to the application using the following command:

pserve development.ini --reload

it failed with this error message:

pyramid.exceptions.ConfigurationError: "C:\Users\bert\AppData\Roaming\Python-Eggs\apex-0.9.2dev-py2.7.egg-tmp\apex\locale/" is not a directory

I checked inside the egg, and indeed, there's no "locale" folder inside the apex (I see one in the source code). What shouldI do to fix this? Thanks before.

Ps. Sorry if it's not the appropriate place to ask, please tell me where to ask if you do not accept this kind of question here.

Naming convention problem on SQL Server

Hello, I'm trying to use Apex on a Microsoft SQL Server database (with SQLAlchemy + pyodbc.) Apex is really nice by the way and solves a lot of my user management problems.

The problem I'm having has to do with the check constraint names on Enum types used in the following columns: auth_id.active, auth_user.active, auth_user_log.event.

The problem is that these enums are given hardcoded names which are the same as the related column, and the same 'active' column is used in two tables. This results it it trying to create two constraints both named 'active' and failing:

sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42S01', "[42S01] [Microsoft][SQL Server Native Client 11.0][SQL Server]There is already an object named 'active' in the database. (2714) (SQLExecDirectW); [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Could not create constraint. See previous errors. (1750)") u"\nCREATE TABLE auth_users (\n\tid INTEGER NOT NULL IDENTITY(1,1), \n\tauth_id INTEGER NULL, \n\tprovider NVARCHAR(80) NULL, \n\tlogin NVARCHAR(80) NULL, \n\tsalt NVARCHAR(24) NULL, \n\tpassword NVARCHAR(80) NULL, \n\temail NVARCHAR(80) NULL, \n\tcreated DATETIME NULL, \n\tactive VARCHAR(1) NULL, \n\tPRIMARY KEY (id), \n\tFOREIGN KEY(auth_id) REFERENCES auth_id (id), \n\tCONSTRAINT active CHECK (active IN ('Y', 'N', 'D'))\n)\n\n" ()

My suggested solution is to use a SQLAlchemy naming convention as documented here:

http://docs.sqlalchemy.org/en/rel_0_9/core/constraints.html#constraint-naming-conventions

Such as this:

convention = {
  "ix": 'ix_%(column_0_label)s',
  "uq": "uq_%(table_name)s_%(column_0_name)s",
  "ck": "ck_%(table_name)s_%(constraint_name)s",
  "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
  "pk": "pk_%(table_name)s"}

metadata = MetaData(naming_convention=convention)
Base = declarative_base(metadata=metadata)

Better yet, allow users of the Apex library to hook in their own naming convention.

For now my workaround is to modify the Apex source directly in my virtualenv to use the above naming convention. Thanks.

Why not re-use pyramid.security.Authenticated

I was surprised to find my view with permission=pyramid.security.Authenticated was always throwing forbidden errors. Reading the example app I discovered what I wanted was the string 'authenticated'. Is there are reason not to re-use the pyramid built-ins here?

multiple accounts

Hi!
I'm trying to get apex to work with both a local and OpenAuth account (specifically twitter, but really I'm asking in general), with both auth methods associated with a single user (so a user could login either with name/pass or twitter). Having been unable to find an example of this sort of thing, I've been trying to get it working via a custom OpenidAfter method, though it's proving tricky. Is there a straight forward way to do this using Apex? I don't want to reinvent any wheels.

Ajax 302 Found Redirect Bug

I have a request handler:

@action(renderer="json", accept='application/json', request_method='POST')
@action(renderer="json", accept='application/json', request_method='GET')
def profile(self):
return { "id" : self.request.user.id }

clientside, i access this resource via angular.js:

$http.get('/api/profile');
$http.post('/api/profile', { hello: "world" });

get works as expected, can access this resource via ajax or browser.

post never works, always get status: 302 Found

Redirected to login page by apex:

http://site.com/auth/login?came_from=http://site.com/api/profile

EVEN WHEN there are no permissions set for the handler as with the example above.

Why am i getting redirected from a view that does not require permissions?

Have any advice for how to solve this issue?
In particular I would like to be able to post json to pyramid
without being redirected, any idea what am i missing?

velruse.app.parse_config_file was removed

in velruse commit bbangert/velruse@018d206 the velruse app was rewritten as a full pyramid app, and the parse_config_file method of velruse.app was removed, since then apex is not compatible with velruse

I haven't checked yet how recent velruse works and how it was previously integrated with apex, but I'm sure that this incompatibility should be fixed asap.

NameError: global name 'auth' is not defined

URL: http://www.mydomain.com/auth/apex_callback
File '/root/mydomain.com/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/evalexception.py', line 431 in respond
app_iter = self.application(environ, detect_start_response)
File '/root/mydomain.com/lib/python2.6/site-packages/pyramid-1.4a3-py2.6.egg/pyramid/router.py', line 251 in call
response = self.invoke_subrequest(request, use_tweens=True)
File '/root/mydomain.com/lib/python2.6/site-packages/pyramid-1.4a3-py2.6.egg/pyramid/router.py', line 227 in invoke_subrequest
response = handle_request(request)
File '/root/mydomain.com/lib/python2.6/site-packages/pyramid-1.4a3-py2.6.egg/pyramid/tweens.py', line 20 in excview_tween
response = handler(request)
File '/root/mydomain.com/lib/python2.6/site-packages/pyramid_tm-0.5-py2.6.egg/pyramid_tm/init.py', line 100 in tm_tween
response = handler(request)
File '/root/mydomain.com/lib/python2.6/site-packages/pyramid-1.4a3-py2.6.egg/pyramid/router.py', line 161 in handle_request
response = view_callable(context, request)
File '/root/mydomain.com/lib/python2.6/site-packages/pyramid-1.4a3-py2.6.egg/pyramid/config/views.py', line 369 in viewresult_to_response
result = view(context, request)
File '/root/mydomain.com/lib/python2.6/site-packages/pyramid-1.4a3-py2.6.egg/pyramid/config/views.py', line 480 in _requestonly_view
response = view(request)
File '/root/mydomain.com/apex/apex/views.py', line 263 in apex_callback
auth = apexid_from_token(request.POST['token'])
File '/root/mydomain.com/apex/apex/lib/libapex.py', line 93 in apexid_from_token
if 'profile' in auth:
NameError: global name 'auth' is not defined

in apex/lib/libapex.py, the two lines of auth initialization code are commented out.
91 #auth = json.loads(dbsession.query(KeyStorage.value).
92 # filter(KeyStorage.key==token).one()[0])

Microsoft Live Error: ThirdPartyFailure: The HTTP request was forbidden with client authentication scheme 'Anonymous'.

Running into errors with Live ID authentication, it just started without any changes on our application side. Here is what is being used:
pyramid (1.5.1)
pyramid-mako (1.0.1)
velruse (1.1.1)
apex (0.9.10dev)

I am seeing the same issue with the example code located at https://github.com/cd34/apex

Exact details of error thrown:
Exception happened during processing of request from ('127.0.0.1', 57998)
Traceback (most recent call last):
File "D:\env\lib\site-packages\paste-1.7.5.1-py2.7.egg\paste\httpserver.py", l
ine 1068, in process_request_in_thread
self.finish_request(request, client_address)
File "D:\python27\Lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "D:\python27\Lib\SocketServer.py", line 649, in init
self.handle()
File "D:\env\lib\site-packages\paste-1.7.5.1-py2.7.egg\paste\httpserver.py", l
ine 442, in handle
BaseHTTPRequestHandler.handle(self)
File "D:\python27\Lib\BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "D:\env\lib\site-packages\paste-1.7.5.1-py2.7.egg\paste\httpserver.py", l
ine 437, in handle_one_request
self.wsgi_execute()
File "D:\env\lib\site-packages\paste-1.7.5.1-py2.7.egg\paste\httpserver.py", l
ine 287, in wsgi_execute
self.wsgi_start_response)
File "D:\env\lib\site-packages\paste-1.7.5.1-py2.7.egg\paste\urlmap.py", line
203, in call
return app(environ, start_response)
File "D:\env\lib\site-packages\pyramid\router.py", line 242, in call
response = self.invoke_subrequest(request, use_tweens=True)
File "D:\env\lib\site-packages\pyramid\router.py", line 217, in invoke_subrequ
est
response = handle_request(request)
File "D:\env\lib\site-packages\pyramid\tweens.py", line 21, in excview_tween
response = handler(request)
File "D:\env\lib\site-packages\pyramid\router.py", line 118, in handle_request

root = root_factory(request)

File "D:\env\lib\site-packages\velruse-1.1.1-py2.7.egg\velruse\providers\live.
py", line 88, in callback
'No reason provided.'))
ThirdPartyFailure: The HTTP request was forbidden with client authentication sch
eme 'Anonymous'.

Python 3.5.1: TypeError: Class advice impossible in Python3. Use the @implementer class decorator instead

Following the instructions at

http://thesoftwarestudio.com/apex/INSTALL.html

I add the line

config.include('apex', route_prefix='/auth')

to init.py

and re-run the pyramid webapp

but I get the stack below with the error ... Class advice impossible in Python3 ...

I'm using Python 3.5.1 Pyramid 1.7.3 and apex 0.9.11(on a mac). I'm not sure where the issue is exactly but it seems to be in apex:

  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/interfaces.py", line 14, in ApexImplementation
Traceback (most recent call last):
  File "../bin/pserve", line 9, in <module>
    load_entry_point('pyramid==1.7.3', 'console_scripts', 'pserve')()
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/scripts/pserve.py", line 60, in main
    return command.run()
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/scripts/pserve.py", line 371, in run
    global_conf=vars)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/scripts/pserve.py", line 406, in loadapp
    return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/util.py", line 58, in fix_call
    reraise(*exc_info)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/compat.py", line 32, in reraise
    raise e.with_traceback(tb)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/Users/me/tmp/env/apextest/example/example/__init__.py", line 11, in main
    config.include('apex', route_prefix='/auth')
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/config/__init__.py", line 771, in include
    c = self.maybe_dotted(callable)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/config/__init__.py", line 871, in maybe_dotted
    return self.name_resolver.maybe_resolve(dotted)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/path.py", line 320, in maybe_resolve
    return self._resolve(dotted, package)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/path.py", line 327, in _resolve
    return self._zope_dottedname_style(dotted, package)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/path.py", line 376, in _zope_dottedname_style
    found = __import__(used)
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/__init__.py", line 18, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/interfaces.py", line 10, in <module>
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/interfaces.py", line 14, in ApexImplementation
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/zope.interface-4.2.0-py3.5-macosx-10.6-intel.egg/zope/interface/declarations.py", line 412, in implements
    raise TypeError(_ADVICE_ERROR % 'implementer')
TypeError: Class advice impossible in Python3.  Use the @implementer class decorator instead.

Quickstart documentation out of date

When installing apex with Pyramid 1.5, the development.ini does not contain a

[app:example]

section.

It appears by default there is an [app:main] section instead.

This causes further trouble later because the docs go on later to suggest to add a

[composite:main]

section. This means that passing this ini file to serve will result in an ambiguity error since there are too many sections affixed with :main

The documentation for Pylons here, http://pylonsbook.com/en/1.1/pylons-internal-architecture.html states that, "Only one section other than [server:main] can have the name :main"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.