Giter Site home page Giter Site logo

Comments (14)

rcw-2 avatar rcw-2 commented on June 9, 2024 2

This will probably be fixed by #115.

from flask-ldap3-login.

rcw-2 avatar rcw-2 commented on June 9, 2024 1

@jiamliang @rcw-2 which version of the library are you using? Have you tested 1.0.0aX version? I can release a new alpha of 1.0.0 if that works for you. The patch in the PR above cannot be cleanly applied to 0.9 so not possible to release it for 0.9 without some merge conflict resolution.

I use 0.9.18. with Flask<3 and Werkzeug<3. 1.0.0a2 works too, with the same restrictions for Flask and Werkzeug.

I don't have a reason to stick with 0.9, so a new 1.0.0a version (and maybe a 1.0 release soon) would be fine for me.

from flask-ldap3-login.

nickw444 avatar nickw444 commented on June 9, 2024 1

1.0.2a1 is now released: https://github.com/nickw444/flask-ldap3-login/releases/tag/1.0.2a1

from flask-ldap3-login.

rcw-2 avatar rcw-2 commented on June 9, 2024

With Flask 3.0.0, you get an exception:

Traceback (most recent call last):
  [...]
  File "/.../lib/python3.10/site-packages/flask_ldap3_login/__init__.py", line 8, in <module>
    from flask import _request_ctx_stack as stack
ImportError: cannot import name '_request_ctx_stack' from 'flask' (/.../lib/python3.10/site-packages/flask/__init__.py)

from flask-ldap3-login.

jiamliang avatar jiamliang commented on June 9, 2024

expect the release.

from flask-ldap3-login.

nickw444 avatar nickw444 commented on June 9, 2024

@jiamliang @rcw-2 which version of the library are you using? Have you tested 1.0.0aX version? I can release a new alpha of 1.0.0 if that works for you. The patch in the PR above cannot be cleanly applied to 0.9 so not possible to release it for 0.9 without some merge conflict resolution.

from flask-ldap3-login.

jiamliang avatar jiamliang commented on June 9, 2024

@jiamliang @rcw-2 which version of the library are you using? Have you tested 1.0.0aX version? I can release a new alpha of 1.0.0 if that works for you. The patch in the PR above cannot be cleanly applied to 0.9 so not possible to release it for 0.9 without some merge conflict resolution.

i have download flask_ldap3_login-1.0.0a2-py3-none-any.whl and install by running:
pip install flask_ldap3_login-1.0.0a2-py3-none-any.whl
it looks ok:

Installing collected packages: flask-ldap3-login
Successfully installed flask-ldap3-login-1.0.0a2
# pip show flask_ldap3_login
Name: flask-ldap3-login
Version: 1.0.0a2
Summary: LDAP Support for Flask
Home-page: https://github.com/nickw444/flask-ldap3-login
Author: Nick Whyte
Author-email: [email protected]
License: UNKNOWN
Location: /work/nlu-py/lib/python3.11/site-packages
Requires: Flask, Flask-wtf, ldap3, WTForms
Required-by: 
(nlu-py) root@a51c30e62d11:/work# 

when i start my scripts, it failed:

(nlu-py) root@a51c30e62d11:/work# python app.py 
Traceback (most recent call last):
  File "/work/nlu-py/lib/python3.11/site-packages/flask_ldap3_login/__init__.py", line 8, in <module>
    from flask import _app_ctx_stack as stack
ImportError: cannot import name '_app_ctx_stack' from 'flask' (/work/nlu-py/lib/python3.11/site-packages/flask/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/app.py", line 9, in <module>
    from flask_ldap3_login import LDAP3LoginManager, AuthenticationResponseStatus
  File "/work/nlu-py/lib/python3.11/site-packages/flask_ldap3_login/__init__.py", line 10, in <module>
    from flask import _request_ctx_stack as stack
ImportError: cannot import name '_request_ctx_stack' from 'flask' (/work/nlu-py/lib/python3.11/site-packages/flask/__init__.py)

from flask-ldap3-login.

jiamliang avatar jiamliang commented on June 9, 2024

Currently, I am running version 0.9.18 of flask_ldap3_login. I've made some minor modifications to the flask_ldap3_login/__init__.py file to ensure it runs well in my environment.

L5~L8:
from:

try:
    from flask import _app_ctx_stack as stack
except ImportError:  # pragma: no cover
    from flask import _request_ctx_stack as stack

to:

from flask import current_app, has_app_context

L184-L185 and
L215-L216
from:

        ctx = stack.top
        if ctx is not None:

to:

        if has_app_context():
            ctx = current_app.app_context()

L206~L208:
from:

        ctx = stack.top
        if ctx is not None and connection in ctx.ldap3_manager_connections:
            ctx.ldap3_manager_connections.remove(connection)

to:

      if has_app_context():
           ctx = current_app.app_context()
           if hasattr(ctx, 'ldap3_manager_connections'):
               if connection in ctx.ldap3_manager_connections:
                   ctx.ldap3_manager_connections.remove(connection)

L723~L724:
from:

        ctx = stack.top
        if ctx is None:

to:
if not has_app_context():

My modifications have made it work, but I actually don't understand the specific logic in the code. Therefore, I am hoping for an official release that would "reliably" fix this issue.
Thanks all.

from flask-ldap3-login.

jiamliang avatar jiamliang commented on June 9, 2024
root@a51c30e62d11:/work# pip freeze
blinker==1.7.0
certifi==2023.11.17
cffi==1.16.0
click==8.1.7
cryptography==41.0.7
DateTime==5.4
elastic-transport==8.11.0
elasticsearch==8.12.0
Flask==3.0.0
Flask-Cors==4.0.0
flask-ldap3-login==0.9.18
Flask-SQLAlchemy==3.1.1
Flask-WTF==1.2.1
greenlet==3.0.3
itsdangerous==2.1.2
Jinja2==3.1.2
ldap3==2.9.1
MarkupSafe==2.1.3
pyasn1==0.5.1
pycparser==2.21
pycryptodome==3.19.1
PyMySQL==1.1.0
pytz==2023.3.post1
SQLAlchemy==2.0.25
typing_extensions==4.9.0
urllib3==2.1.0
Werkzeug==3.0.1
WTForms==3.1.2
zope.interface==6.1

from flask-ldap3-login.

ArthurMitchell42 avatar ArthurMitchell42 commented on June 9, 2024

Is there an update on progress for this please? The flask_ldap3_login-1.0.0a2-py3-none-any.whl Doesn't work for me.
Thnx

from flask-ldap3-login.

mgjaggers avatar mgjaggers commented on June 9, 2024

@ArthurMitchell42

Is there an update on progress for this please? The flask_ldap3_login-1.0.0a2-py3-none-any.whl Doesn't work for me. Thnx

That doesn't work because the change that is merged into the master branch on issue #115 aren't include on that release. This issue resolves if you build from master though:

git clone https://github.com/nickw444/flask-ldap3-login.git
cd flask-ldap3-login
pip install .

I haven't got much further than running the program, but it seems okay so far.

from flask-ldap3-login.

ArthurMitchell42 avatar ArthurMitchell42 commented on June 9, 2024

Great, thanks.
Do we have an expected date for an updated release please?

from flask-ldap3-login.

nickw444 avatar nickw444 commented on June 9, 2024

I don't think I can give an expected date - I don't get paid to work on this project, nor do I use it personally, so finding time and motivation to work on it is difficult. Currently the CI pipeline is broken (which also handles publishing of new versions) so it needs to be fixed first: #116

from flask-ldap3-login.

Related Issues (20)

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.