« first day (1398 days earlier)      last day (3775 days later) » 

00:04
i am doing all the things like in blog.miguelgrinberg.com/post/… but still getting a socket error
maybe it happen due to NAT on my work net
idk
are you on a specific environment, or local?
localhost
i'm using this function from librelist archives
```pythondef send_awaiting_confirm_mail(user):
"""
Send the awaiting for confirmation mail to the user.
"""
subject = "We're waiting for your confirmation!!"
mail_to_be_sent = Message(sender='[email protected]',subject=subject, recipients=user.email)
confirmation_url = url_for('activate_user', user_id=user.id,
_external=True)
mail_to_be_sent.body = "Dear %s, click here to confirm: %s" % (user.email, confirmation_url)

mail.send(mail_to_be_sent)
does the user's email exist?
yes, because i use my own e-mail to register user
and i using another to send confirmation url
all in gmail
maybe i should try/except and print error?
got pudb? Might as well try that, with iPython
00:22
when i try/except my mail sending fucntion it's just do nothing
not sending an email
not raise any exceptions D:
yeah that's why I recommend pudb haha
wait, are you using flask login?
yeah, i using it, i think i might use flask-security for better expirience
so why pass user into your function? Why not do this?
@app.route('/confirmation_email')
def make_confirmation_email():
    email = current_user.email
00:28
and after?
just like the rest. I have a sneaking suspicion that your user is None
user in his place :D
i've misunderstaing why i should do another app.route
not sure, don't know what your app looks like
my app have a complex structure now
have an admin interface
with two instances of it - /admin /moder
i have bugs now with it
@app.route('/activate_user/<user_id>')
def activate_user(user_id):
"""
Activate user function.
"""
found_user = models.User.query.sqlalchemy.get_or_404(user_id)
if not found_user:
return abort(404)
else:
if found_user['status'] == 'awaiting_confirm':
found_user.status = 'active'
# mailing.send_subscription_confirmed_mail(found_user)
flash('user has been activated', 'info')
elif found_user['status'] == 'active':
flash('user already activated', 'info')
return redirect(url_for('login'))
is it open-source or private?
00:34
private ((
nvm about this
brb, need to ask an admin about ip restrictions
he is so busy ((
what's (( ?
it is my bad habit - typing "((", like me sad
by the way errno 10061 means connection refused?
I guess it has something to do with the sender port or something?
it may be
i saw the dump() log of werkzeug debugger - when it raise err, flask mail trying to open socket at 127.0.0.1:25, but my app on 192.168.55.102. Is that necessary?
your app is on that IP? I thought you were running locally
00:47
it's ip of my laptop
changing ip to localhost giving nothing - still socket error
you should just print all the values hah
i doing it now :D
user
<app.models.User object at 0x02FCFC30>
subject
"We're waiting for your confirmation!!"
confirmation_url
'http://127.0.0.1:5000/activate_user/23'
mail_to_be_sent
<flask_mail.Message object at 0x02E7F7B0>
function works fine
sounds like some sort of IP blocking or soemthing
Aww yisss
UnicodeError :D
flask-mail don't read configuration file correctly, because i create it before app.config.from_object
01:03
oooh, you're not doing the application factory approach?
nice pic :) i'll take care about that, because app is still raw and messy thing
app factories are kinda nice because you can mess up a lot of stuff and more easily know why it went wrong
i'll take this opinion for favourites :D
and going to hack and smash all that ugly lines of code
thanks for advice
are you doing like, a single-file approach?
hmm, i have one init to rule all other init's, i have app folder structure like this
01:08
oh okay cool that works
maybe it is not suite for my project
there are many circular imports
do you use blueprints?
like i have one file with app, and another with ``from app import app```, and in main __init__.py i just import that thing
not sure if i use them
it may helps with separating admin and moderator views
but i still don't know how to rule it with flask-login, because even if i login into admin, moderator have logined too
that wouldn't matter, you'd just reference current_user
add a @before_request handler on a blueprint to make sure the current_user is an admin
like if current_user.roles.name == 'admin'
and return True
01:18
yeah, in your model you could include a method like has_role to check the role name, then use that in the before request
@before_request
def authorize():
    if not current_user.has_role('admin'):
        abort(401) # not authorized
i can't do it due to AnonymousUserMixin - it don't care about what i have to add, it just fall to error with message AnonymousUserMixin has not attribute <name>
maybe just override AnonymousUserMixin with my own
yeah you can, in your models you can make an AnonymousUser class
class AnonymousUser(db.Model, AnonymousUserMixin):
    def has_role():
        return False
AnonymousUserMixin is a stock model from flask-login
yep, know about that, example is for that
oooohhh i forget about db.Model
class AnonymousUser(db.Model, AnonymousUserMixin):
    def is_admin(self):
        return self.roles.name == "admin"
but how i can trigger that flask-login to use my own anonym?
01:27
I'm pretty sure when you use anonymoususermixin, it automatically does it
you also probably don't want to do that with AnonymousUser, just return False for everything. AnonymousUser doesn't have an attribute "role"
ah, thanks, chatting with expirienced people is pretty better then just read dry documentation
that's why I'm here a lot hah
i will stay here forever hahah
@corvid, what kind of music you're listen, when you are coding?
01:43
depends, I like lots of stuff, but folk metal a lot of the time, you?
i listen to chill, ambient, i really like sounds of space and other strange vibrations in music. Also i prefer Burial, Thriftworks, Shlohmo and other.
but when i don't coding i listen to Kreator hahha
Kreator is good, I like that Dystopia song by them
i like Phantom Antichrist, Endorama
they make a good stuff
a lot of good stuff
I like UneXpecT, they're just crazy
in vk.com has a community called Music against humanity
so much punk and hardcore
but why it happen - i do it like you post above, class AnonymUser(db.Model, AnonymousUserMixin)
and it's just saying about that there is no method you're trying to include in your godbless model
and strange timeout with sending email
02:16
@corvid, you still here?
 
3 hours later…
05:33
cbg
05:45
you may see our chat with corvid today
btw that solution i've now - works just as expected, but now i want to refactor it and remove logic errors
@Ffisegydd haha
@Ffisegydd just found out, we're using 1 service for crowdsourcing
actually our spam filter does better, so our company could change business into pretending to be humans for crowdsourcing businesses...
1 good measurement for SO posts should be a) how properly it is formatted (maybe number of Markup tags used vs the amount of text)...
then tag all code blocks with different namespace
try to find out which programming language and remove comments appropriately
06:05
morning
morning, i've 4:11 pm
Multiplayer looks dope
06:38
Cbg
Wrong window..
06:58
Cbg
Got my matplotlib bronze badge.
Congratulations!
Who came first?
Yea, cool
39th person to get the bdage
And Joe Kington got it first which is no surprise.
07:20
Jeez, I need to get some more sleep. I just started rooting around for a matplotlib SE site
When you obviously mean a matplotlib tag badge
facepalm
hehehe
0
Q: Add arrays in a boolean way

user3020849I have some matrices that represent the segmented parts of a picture. I need to "Add" the segments up to make the segmented picture. A simpler explanation can be made with arrays. a = [3, 0, 0, 0] b = [3, 1, 0, 0] c = [0, 0, 0, 1] how can I make something like: result = a AND b AND c result...

I think I'm gonna walk away.
Too early for this cabbage.
hmhm
I have the bestest class in the world, dotdict
As to my knowledge there is no math symbol for what I want. — user3020849 17 secs ago
anyone who's had to deal with silly json api structures will love this
oiashgodfsbjdnbjeqnjbnrkosfgnbodjfsnjabjgdbfj
07:24
hahaha
I love the little numpy argument in the comments
Buh.
VtC and walk away.
Need to go to work, be back in a bizzle.
07:57
Cbg :)
08:27
Argh! I still don't get what that guy is trying to do?! What if one array was: [1,0,0] and the next was [2,0,0]. What happens then?
[2, 0, 0]
Basically he wants to iterate over the lists and replace each element with the one previously
BUT if the next element is 0 he doesn't want it to replace anything
So [2, 1, 0] with next as [3, 0, 1] would result in [3, 1, 1]
Gotcha
Ah I see he's answered his own question
Ew, that's some nasty casing: "non_Destructive_pixel_addition"
Yep.
and it'll be slooooooooow.
Using Python for loops.
When you first pointed out the question, I was idly musing if zipping the arrays together would work
But didn't give it any serious thought
08:34
Heh yeah that's not a bad idea.
I'm gonna steal yo ideeeeeeeea!
SON OF A...
That's fine, I'm not actually too fussed about my SO points
Is it even worth trying to save that question?
Nope.
I'm not gonna post the answer.
I just wanna see if I can do it.
I'm then gonna timeit for comparison.
My first mental draft was zipping the arrays and then doing a list comprehension, maxing each zipped tuple
But he wasn't looking for the max
08:39
Yeah
I need a get_last_non_zero_element function.
I think you should write it in C for speed ;)
FORTRAN!
Bless you
i get this error @ Unable to start phantomjs with ghostdriver
dir to phantomjs is : executable_path=u'/home/username/mysite/phatomjs/bin/phantomjs')
MHWHAHAHAHAHAHAHAHAHAHA!
@IntrepidBrit...it is done...one line...
result = [row[np.max(np.nonzero(row)) if len(np.nonzero(row)[0]) else 0] for row in np.array(list(zip(a, b, c)))]
Bask in its magnificence!
BASK IN IT!
08:55
@odaialghamdi Sorry bud, I only use casper.js and even that's infrequent
I refuse to bask. That's against PEP20 :P
How fast is it?
Dunno, I don't know how his function works so not sure how to test it
Let me see if I can work it out
After the work you've done, it would be a shame not to salvage the question :P
If I were to answer it I'd take it out of a list comprehension.
09:00
Why?
PEP20 ;)
He uses underscored dromedary casing. He does not deserve PEP20 :P
09:17
Upvoted
It offended me seeing the other answer at the top
Danke.
rbrb sec
09:35
Do people really downvote because of the language used?
25
A: Encouraging people to explain downvotes

cletusThe more I think about it, the more I think that downvotes per se aren't the problem. Incorrect downvotes are. Take this answer, Tim, who was actually kind enough to leave a comment, is actually wrong. The answer works. However well-intentioned, he's just wrong. Those kinds of downvotes annoy me....

Some people might do, though I think it's rare
He doesn't exactly sound professional though with "...ton by Python fanboys..."
Yeah. Sounds like a bit of a "chip on the shoulder" type
@Antti article on VW may be of some interest
Please i need your help guys
i'm getting this error : ../phatomjs/bin/phantomjs
i mean this : Unable to start phantomjs with ghostdriver
This is the Python chatroom.
JS is over there *points over there*
09:49
I'm using python to run phantom
Have you asked a question on the main site?
i'm not allowed to ask
Create another account and ask :P
give me your account :p
09:52
cbg
@odai you can't just use this room as your own personal help desk. If you can't ask questions on the site then you need to work out why and try to fix it.
If you've got low quality old posts then improve them.
Answer questions to try and get rep and get yourself out of the hole.
@JonClements Look! A wild Jon appeared
@Jon BRIIIIIIIAN!
@Ffisegydd STEWIE!!!!!!!!!!!!!!!!!
@IntrepidBrit growls with his frothy mouth
wants to eat more humans...
umm... maybe I should change my name to Cujo :)
How can you chase anyone with such a huge head?
09:55
@IntrepidBrit and 3 legs...
Cujo Clements. Has a ring to it...
You just have to promise to stand still... or just run away really, really slowly
Or run towards you.
/me puts a fine bottle of scotch in front of him - come on @Intrepid, there's a good Intrepid... come get the scotch... you know you want to...
I'm partial to gin myself.
09:58
@JonClements eyes the bottle warily What kind? I'm not moving from my seat if it's Famous Grouse
Nah nah. It's high quality stuff... Bells
@IntrepidBrit Highland Park
I've got a miniature bottle of Glenkinchie on my desk actually.
Cbg
How to override Django Admin changelist_view()? I need to add button "Export to xlsx" next to "Add.." and export all data from list_display. Any suggestion?
@JonClements Mmm. That'll do...
10:00
@IntrepidBrit do... it's about £50 a bottle... how expensive are you tastes man!?
@Ffisegydd Gin is literally the only alcohol I cannot stand. I can absinthe, Ouzo, Vodka, Sambucca... But gin. Bleurrrrgh
@JonClements I usually buy £70 bottles ;)
Absinthe is the devil. Vodka is nearly as bad. Sambucca is as bad as vodka.
Gin is life.
@IntrepidBrit I have a £400 bottle but I'm not using that to lure you into a trap except for special occasions
The only problem with gin is that it's not very nice on its own, so I feel bad buying the expensive stuff when I'm gonna be mixing it.
@IntrepidBrit how do you feel about Sloe Gin though?
@Ffisegydd Tolerable. At best.
10:02
@Ffisegydd I made a bottle about 15 years ago
@JonClements Aren't traps always special occasions?
@IntrepidBrit you're wrong. In more ways than one.
@Ffisegydd My father was a cruel man. When I was a kid, he'd pass me Pastis and tell me it was lemonade ;)
@IntrepidBrit ever tried this one?
Chartreuse is...I dunno...strange.
10:05
@Ffisegydd You know, that has never graced my liver
@Ffisegydd it's green - green is nature's warning sign
@JonClements No I've not had the pleasure of its company
@JonClements Like apples
green is a no go
@mamasi Is this for the dropdown menu when you've selected multiple instances of the model?
Although, other people at traffic lights don't seem to realise this... that annoys me
10:08
@IntrepidBrit: You mean the custom action? It should not be action
@mamasi So on the front page you want to add a custom "action" alongside Add and Change?
@IntrepidBrit wstaw.org/w/2TB6 It should export all the data from the list.
With you
@IntrepidBrit Yes, exactly
@mamasi I usually don't need to muck around with the admin interface
So I'm not going to be a world of good to you, but have you seen this?
10:15
@IntrepidBrit Thanks, I'll check it out
Hm, I should really think about upping my score at some point
I get little spurts of activity.
@Ffisegydd you're only 63 off from beating me and gaining access to another review queue :)
Review queue?
Oh you mean tag wiki?
Words worst review queue :P
Yeah... it's something - no more cool stuff until 10k :(
10:26
Tbf, the coolest perk is getting 100 rep across all of SE
Yeah to be honest from a personal POV that's probably most useful for the majority of users.
I'm just going to wait for davidism to get to 5k then we're going to form a hivemind so we've actually got 10k so we can access the cooler stuff.
You know that's not how it works right?
Right?
That's what you think.
>_>
0
Q: accessing in (passing to) django models signal methods like pre_save, pre_delete the request.user?

andiI have to track the history of all of changes, which occure to my models. I also keep track of user making this changes. For now I was dealing with in views.py but I would like to utilitize this functionallity using django signals like pre_save, pre_delete for each of models. The question are: ...

I like this guy's turn of phrase for option 3
Although I admittedly didn't actually answer his question...
Hm
@IntrepidBrit Yeah, but you only need 200 on one site to do that
10:34
@JonClements Doesn't stop it from being the coolest! ;)
umm... pythonprogramming.guru is available as a domain :)
Aren't the generic TLDs stupidly expensive?
£35
Oh no... it's on sale for £18
I was tempted by an io TLD but I decided against it.
pythonprogramming.com is currently £1.99
10:42
I solved someones problem last night based solely on the fact that they used an Iranian website to host the photo, that's come some SHERLOCK HOLMES cabbage right there.
@Ffisegydd oh... was that the encoding thingy ?
Yerp.
Wow... pythonprogramming.ninja is there
datetime using the locale to pick how dates should be formed and matplotlib not able to encode Persian properly.
Right, off out for a late breakfast, early lunch, bbiab
10:46
@Ffisegydd nicely done
@IntrepidBrit: I get "__init__() takes exactly 13 arguments (3 given)" in this line: cl = ChangeList(request, model). I think the code is outdated or something :(
@mamasi It's quite possible.
Does it work as a decent starting point though?
@IntrepidBrit: Yes, this is helpful. Thanks. I need to fix first
Right I'm going to lunch. @IntrepidBrit you're in charge.
10:57
cbf
@Ffisegydd Uh oh.
@MartijnPieters They've left me in charge... What do I do?!

« first day (1398 days earlier)      last day (3775 days later) »