#django

/

      • AimerPaddle has quit
      • chuckoy
        I've got a question about signals. I've got a Django project (call this project B) installed via pip and then included into my main project's (project A) INSTALLED_APPS. If I'm emitting a signal from project B and I have a receiver in project A connecting to that signal (via from projectA.signals import signal123; @receiver(signal123)...), will that receiver be able to receive signals emitting from project B? I've confirmed it works i
      • cyphase has quit
      • project A but it doesn't seem to receive signals emitted from project B.
      • kyheo has quit
      • jonez
        chuckoy, that sounds like an odd arrangement. are you certain there are no other options?
      • Koterpillar
        chuckoy: A and B are apps, not projects
      • signals are not isolated between apps and it should work
      • chuckoy
        @jonez, it's because project B is being used across 3 different projects. We sort of centralised the models and services among other things there so we didn't have to update across 3 different projects whenever a change was made
      • jonez
        ah
      • my first concern was if the different apps have a diff pid, and from what Koterpillar said, they do not
      • Koterpillar
        chuckoy: app B
      • jonez: pids are irrelevant to all this, as are UNIX signals
      • olrrai_ joined the channel
      • chuckoy
        @Koterpillar, is it really an app? My understanding is that apps are the different folders inside a single project, right?
      • jonez
        so the signaling going on is not posix?
      • XofP has quit
      • my fault
      • Koterpillar
        chuckoy: apps are whatever is in INSTALLED_APPS
      • jonez: no, search "django signals"
      • jonez
        ok
      • cyphase joined the channel
      • oh ok I see now
      • cool
      • jonez is a django newb
      • chuckoy
        @Koterpillar I see. I think my misunderstanding stemmed from project B having an app with the same name as project B's name. So there are two separate objects project B and app B. I installed project B via pip and listed app B as an INSTALLED_APP in project A, si that correct?
      • cyphase joined the channel
      • Koterpillar
        you install *Python packages* via pip
      • an app is a module (from a Python standpoint)
      • chuckoy
        @Koterpillar, yes we uploaded project B as a python package via a custom PyPi repo
      • Croves joined the channel
      • Croves has quit
      • Koterpillar
        one package can have multiple apps (e.g. Django has auth, admin, etc.)
      • chuckoy
        so we list projectB as a requirement in our requirements.txt file
      • Koterpillar
        package B
      • chuckoy
        package B which contains a Django project B or is that wrong?
      • Koterpillar
        which contains a Django app B
      • which you put into INSTALLED_APPS
      • chuckoy
        I see. So Django projects don't play into that scenario?
      • Koterpillar
        a Django project is whatever has a settings.py
      • therefore, projects have apps installed in them
      • chuckoy
        I see... this package B has two apps (?) app B and app C which has a settings file. Am I correct in syaing that app C is a Django project on top of being an app?
      • Koterpillar
        the correct thing to say would be that the package B has an app B and a Django project C
      • chuckoy
        Okay
      • So if I'm adding app B from package B into the list of INSTALLED_APPS in project A, the signals being emitted from app B's code *should* be received by receivers in project A/app A's code connecting to that signal, right?
      • Koterpillar
        the signals ignore all this stuff about projects and apps and just work
      • if they don't appear to work for you, verify that you are actually sending them, and then trace through
      • chuckoy
        Okay. Thanks for the help! When I'm emitting the signal from somewhere in app A's code it went into the callback function when I was debugging but not when it was from app B so that's why I had those initial assumptions. I'll try and put some more debugging code later.
      • Can't do it right now, got to go to a meeting :(
      • Thank you Koterpillar
      • eperzhand has quit
      • sol1x has quit
      • EyePulp has quit
      • jhfisc has quit
      • jhfisc joined the channel
      • sandwichheat has quit
      • sandwichheat joined the channel
      • chuckoy has quit
      • csk joined the channel
      • eperzhand joined the channel
      • FreedomFighter joined the channel
      • SecondForm_Glenn has quit
      • SecondForm_Glenn joined the channel
      • chuckoy joined the channel
      • netheranthem has quit
      • raijin joined the channel
      • eperzhand has quit
      • workbean joined the channel
      • darylantony has quit
      • eperzhand joined the channel
      • darylantony joined the channel
      • neilus joined the channel
      • Genitrust joined the channel
      • neilus has quit
      • aristippos has quit
      • royendgel joined the channel
      • romerocesar joined the channel
      • thinkt4nk joined the channel
      • Genitrust has quit
      • k3va has quit
      • Genitrust joined the channel
      • amcorreia has quit
      • jivan
        What's the most straightforward way to convert a urllib3 response to a django response?
      • hamub joined the channel
      • aristippos joined the channel
      • Genitrust has quit
      • aristippos has quit
      • bwreilly has quit
      • Koterpillar has quit
      • Koterpillar joined the channel
      • kuter has quit
      • hamub has quit
      • x-warrior joined the channel
      • FunkyBob
        jivan: copy the headers over, attach a FileResponse to the resposne stream ...?
      • c17r_ joined the channel
      • Zequal joined the channel
      • Zequal
        Hey guys, I am looking to check to see if a user is in a certain group before accessing a specific page. https://paste.pound-python.org/show/rdTMA93duVr...
      • jivan
        Is there anything missing in this that could bite me: https://dpaste.de/pTAs?
      • Zequal
        Is there anything in particular I might be missing?
      • It seems to be returning False for the user, currently.
      • FunkyBob
        Zequal: typically that's considered a poor way to use django's auth system... you should be testing for permissions instead
      • eperzhand has quit
      • also, login_required and user_passes_test there are redundant... the latter will imply the former
      • and what are you hoping to tst by using "if user"?
      • lorddaedra joined the channel
      • Zequal
        FunkyBob: Ah I didn't know that. I've seen a lot of other examples implement both. I'm just trying to validate that the user in LDAP is a member of either one of two specific groups.
      • FunkyBob
        login_required is made from user_passes_test
      • the_rat joined the channel
      • religious has quit
      • SecondForm_Glenn has quit
      • Zequal
        FunkyBob: So would I be using @login_required and @permission_required once I make a permissions object?
      • k3va joined the channel
      • k3va has quit
      • k3va joined the channel
      • the_rat has quit
      • ycon_ joined the channel
      • tulioz joined the channel
      • FunkyBob
        no
      • you can't have permissions if you're not a logged in user... so being logged is is implied by having perms
      • (unless you have some custom auth backend)
      • Zequal
        FunkyBob: What exactly would be ideal to use to accomplish what I am looking to do?
      • FunkyBob
        what I gave you is fine
      • Zequal
        FunkyBob: There's multiple ways to skin a cat, I can import User and Group from contrib.auth - but there are so many other mechanisms in place, I figured there's a cleaner, better way to do what I am trying to do.
      • Oh
      • iiie has quit
      • FunkyBob
        it's not the right way to use groups/perms... and there are hazards [like magic names] ... but it works, and many of us do it :)
      • gah.. mid-day meeting.. better get an early lunch
      • FreedomFighter has quit
      • sandwichheat has quit
      • raijin has quit
      • sandwichheat joined the channel
      • darylantony has quit
      • kennethreitz has quit
      • darylantony joined the channel
      • mribeirodantas joined the channel
      • raijin joined the channel
      • mcspud
        mornin' Bob
      • mcspud waits intently
      • jfisk87 joined the channel
      • FunkyBob
        o/
      • sebastian-w has quit
      • Bryson has quit
      • sebastian-w joined the channel
      • sandwichheat has quit
      • cyphase joined the channel
      • darylantony has quit
      • darylantony joined the channel
      • darylantony has quit
      • mcspud
        \o