Re: [Mailman-Users] Mailman-2.1.23 and reCAPTCHA

2017-06-06 Thread Mark Sapiro
On 06/06/2017 07:23 AM, SP2L wrote:
> 
> 1. The recaptcha/client directory contained from
> the beginning both __init__.py and captcha.py.
> So, "touch /usr/share/pyshared/recaptcha/__init__.py"
> wasn't necessary.


I know that the recaptcha-client package contains
recaptcha/client/__init__.py. I was suggesting that for some unknown
reason, it may also need recaptcha/__init__.py. In order for a directory
to be recognized as a Python module, it must contain a (possibly empty)
__init__.py.


> Yet another problem emerged:
> "Invalid captcha" message,
> regardless of correct response to captcha.
> 
> Need to search for solution.


I can't help with that one.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list Mailman-Users@python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Mailman-2.1.23 and reCAPTCHA

2017-06-06 Thread SP2L

Mark.


Location  /usr/share/pyshared seem to be
specific to Debian as I just checked my old
Debian-7.11 where exactly the same exists.


Best regards.
---
Tom - SP2L

Sent from Xperia Z1 with AquaMail
http:/​/​www​.​aqua-mail​.​com



--
Mailman-Users mailing list Mailman-Users@python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Mailman-2.1.23 and reCAPTCHA

2017-06-06 Thread SP2L

Hello Mark.


First of all I thank you very much for such
complex and self-explanatory elucidation.

Now, I need to say  _NOT GUILTY_  in regards everything
what is beyound control of regular Linux system
user when installing OS from original DVD disc.
I mean for instance, which packages and where
being placed by installation routine.

1. The recaptcha/client directory contained from
the beginning both __init__.py and captcha.py.
So, "touch /usr/share/pyshared/recaptcha/__init__.py"
wasn't necessary.

2. The two directories:
   /usr/share/pyshared/
   /usr/local/lib/python2.7/dist-packages
were created during system install time.

3. Removed  __one additional__  space character
   before " if not...", thus solving indent issue.


Yet another problem emerged:
"Invalid captcha" message,
regardless of correct response to captcha.

Need to search for solution.


Best regards.

---
Tom - SP2L

Sent from Xperia Z1 with AquaMail
http:/​/​www​.​aqua-mail​.​com



--
Mailman-Users mailing list Mailman-Users@python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Mailman-2.1.23 and reCAPTCHA

2017-06-05 Thread Mark Sapiro
On 06/05/2017 10:43 AM, sp2l wrote:

> When I ran "pip install recaptcha-client"
> I got the following message:
> 
>   root@linux:# pip install recaptcha-client
>   Requirement already satisfied (use --upgrade to upgrade): recaptcha-client 
> in /usr/lib/python2.7/dist-packages
>   Cleaning up...
>   root@linux:#
> 
> So, it appears that installing python-recaptcha,
> module recaptcha-client got installed too.
> 
> Therefore I startet to look at issue from a different point of view.
> 
> The error message was:
>   admin(4038):from recaptcha.client import captcha
>   admin(4038):ImportError: No module named recaptcha.client
> 
> Looking at the directory tree I noticed the following chain:
> /usr / share / pyshared / recaptcha / client
> 
> There _IS NEITHER_  recaptcha.client
> _NOR_  recaptcha-client  directory.


You need to understand how Python imports work. The recaptcha/client
directory contains both __init__.py and captcha.py. Thus the

from recaptcha.client import captcha

statement will import the captcha.py file from recaptcha/client/

This is all as it should be. If the import fails it is because
/usr/share/pyshared/ is not in Python's path. This is not too surprising
as it this would normally be installed in
/usr/local/lib/python2.7/dist-packages/ rather than /usr/share/pyshared/.


> In patch supplied by this article:
>   https://www.dragonsreach.it/2014/05/03/adding-recaptcha-support-to-mailman/
> 
> there are twice two lines:
> 
>   sys.path.append("/usr/share/pyshared")
>   from recaptcha.client import captcha
> 
> Changed them to read:
> 
>   sys.path.append("/usr/share/pyshared/recaptcha")
>   from client import captcha
> 
> This way achieved success to have at least
> properly displayed and working recaptcha box.


OK. That's an acceptable work-around. Possibly the issue is there is no
__init__.py file in the distributed recaptcha/ directory. Possibly just

touch /usr/share/pyshared/recaptcha/__init__.py

would also enable this.


> Checked mailman error log file and noticed the following:
> 
>   Jun 05 20:20:03 2017 admin(23429): @@@.
>   admin(23429): [- Mailman Version: 2.1.23 -].
>   admin(23429): [- Traceback --].
>   admin(23429): Traceback (most recent call last):
>   admin(23429):   File "/usr/local/mailman/scripts/driver", line 102, in 
> run_main
>   admin(23429): pkg = __import__('Mailman.Cgi', globals(), locals(), 
> [scriptname])
>   admin(23429):   File "/usr/local/mailman/Mailman/Cgi/subscribe.py", line 149
>   admin(23429): if email == mlist.GetListEmail():
>   admin(23429):   ^
>   admin(23429): IndentationError: unindent does not match any outer 
> indentation level


In the process of applying the patch and/or editing the file, you have
broken the formatting of /usr/local/mailman/Mailman/Cgi/subscribe.py

The patched code beginning around line 130 should look like

 remote = os.environ.get('REMOTE_HOST',
 os.environ.get('REMOTE_ADDR',
'unidentified origin'))

 # recaptcha
 captcha_response = captcha.submit(
 cgidata.getvalue('recaptcha_challenge_field', ""),
 cgidata.getvalue('recaptcha_response_field', ""),
 mm_cfg.RECAPTCHA_PRIVATE_KEY,
 remote,
 )
 if not captcha_response.is_valid:
 results.append(_('Invalid captcha'))

  # Was an attempt made to subscribe the list to itself?
  if email == mlist.GetListEmail():
  syslog('mischief', 'Attempt to self subscribe %s: %s', email,
remote)

The lines

 remote = os.environ.get('REMOTE_HOST',
 # recaptcha
 captcha_response = captcha.submit(
 if not captcha_response.is_valid:
 # Was an attempt made to subscribe the list to itself?
 if email == mlist.GetListEmail():

in the above MUST be indented exactly 4 spaces, no tabs

> At this point I am simply stucked...
> All suggestions, advices are very welcomed.
> 
> BTW, should recaptcha box be positioned
> at the bottom of browser window?


Questions such as this should be addressed to the author of the patch.
See .

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list Mailman-Users@python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Mailman-2.1.23 and reCAPTCHA

2017-06-05 Thread sp2l


-Original message - 
From: Mark Sapiro

Sent: Sunday, June 4, 2017 1:04 AM
To: mailman-users@python.org
Subject: Re: [Mailman-Users] Mailman-2.1.23 and reCAPTCHA

...


The patch you installed requires the installation of recaptcha-client
<https://pypi.python.org/pypi/recaptcha-client/>.

This is not recaptcha <https://pypi.python.org/pypi/recaptcha/1.0rc1>.

sudo pip install recaptcha-client

should do it.

--
Mark Sapiro <m...@msapiro.net>The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--



Hello Mark.

Thank you for your suggestion,
but apparently this was not the case...

When I ran "pip install recaptcha-client"
I got the following message:

  root@linux:# pip install recaptcha-client
  Requirement already satisfied (use --upgrade to upgrade): 
recaptcha-client in /usr/lib/python2.7/dist-packages

  Cleaning up...
  root@linux:#

So, it appears that installing python-recaptcha,
module recaptcha-client got installed too.

Therefore I startet to look at issue from a different point of view.

The error message was:
  admin(4038):from recaptcha.client import captcha
  admin(4038):ImportError: No module named recaptcha.client

Looking at the directory tree I noticed the following chain:
/usr / share / pyshared / recaptcha / client

There _IS NEITHER_  recaptcha.client
_NOR_  recaptcha-client  directory.

In patch supplied by this article:
  https://www.dragonsreach.it/2014/05/03/adding-recaptcha-support-to-mailman/

there are twice two lines:

  sys.path.append("/usr/share/pyshared")
  from recaptcha.client import captcha

Changed them to read:

  sys.path.append("/usr/share/pyshared/recaptcha")
  from client import captcha

This way achieved success to have at least
properly displayed and working recaptcha box.

Please navigate to one of test lists to see above:

  http://www.sp2l.ampr.org/mailman/listinfo

After filling the form, satisfying recaptcha requirements
then clicking "Subscribe" I received another error message
in web browser window:

  Bug in Mailman version 2.1.23

  We're sorry, we hit a bug!

  Please inform the webmaster for this site of this problem.
  Printing of traceback and other system information has been explicitly 
inhibited,

  but the webmaster can find this information in the Mailman error logs.

Checked mailman error log file and noticed the following:

  Jun 05 20:20:03 2017 admin(23429): @@@.
  admin(23429): [- Mailman Version: 2.1.23 -].
  admin(23429): [- Traceback --].
  admin(23429): Traceback (most recent call last):
  admin(23429):   File "/usr/local/mailman/scripts/driver", line 102, in 
run_main
  admin(23429): pkg = __import__('Mailman.Cgi', globals(), locals(), 
[scriptname])
  admin(23429):   File "/usr/local/mailman/Mailman/Cgi/subscribe.py", line 
149

  admin(23429): if email == mlist.GetListEmail():
  admin(23429):   ^
  admin(23429): IndentationError: unindent does not match any outer 
indentation level



At this point I am simply stucked...
All suggestions, advices are very welcomed.

BTW, should recaptcha box be positioned
at the bottom of browser window?



Best regards.
Tom - SP2L

--
Mailman-Users mailing list Mailman-Users@python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Mailman-2.1.23 and reCAPTCHA

2017-06-03 Thread Mark Sapiro
On 06/02/2017 10:03 AM, sp2l wrote:
> Greetings.
> 
> 
> Does somebody  succeeded intergating
> reCAPTCHA to Mailman-2.1.23 ?
> 
> I tried belows:
> https://www.dragonsreach.it/2014/05/03/adding-recaptcha-support-to-mailman/
> 
> 
> but unsuccessfully...
> 
> Mailman reports the following:
> 
> Jun 02 18:07:09 2017 admin(4038): @@
> admin(4038): [- Mailman Version: 2.1.23 -] 
> admin(4038): [- Traceback --] 
> admin(4038): Traceback (most recent call last):
> admin(4038):   File "/usr/local/mailman/scripts/driver", line 102, in run_main
> admin(4038): pkg = __import__('Mailman.Cgi', globals(), locals(), 
> [scriptname])
> admin(4038):   File "/usr/local/mailman/Mailman/Cgi/listinfo.py", line 37, in 
> 
> admin(4038):from recaptcha.client import captcha
> admin(4038): ImportError: No module named recaptcha.client


The patch you installed requires the installation of recaptcha-client
.

This is not recaptcha .

sudo pip install recaptcha-client

should do it.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list Mailman-Users@python.org
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org