I use mod_wsgi 2.5, mercurial 1.3.1 and Python 2.6.2 on Ubuntu 8.04 After some experimenting with the Mercurial API I was able to get things to write without any output to sys.stdout (without redirecting). First of all I check if the username is provided before creating the repository, providing a dummy one if not. The web2py code readded the list of files it thought interesting before every commit. That caused a warning about files already being in the repository. Instead I know create a .hgignore file if it does not already exists (excluding some file types and errors, cache and databases directories). After that I addremove all files and commit. The list of files committed is now taken from the last changeset, and the commit.html was updated to take info from that one as well.
The change to the .hgignore file and using addremove has the advantage that going to the repository from the commandline gives you far less junk. So no need to redirect sys.stdout, but thanks for the feedback on that anyway (I did read the docs, but it was more than 2 years ago). The patch is available here: http://www.ruamel.eu/download/19820330/web2py/mercurial01.patch Anthon On Sep 22, 2:05 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On Sep 22, 7:12 pm, Anthon <anthon.van.der.n...@googlemail.com> wrote: > > > > > Is anyone using the versioning feature? > > It seems currently broken out of the box on my mod_wsgi/apache system. > > The main problem exists because mercurial writes to sys.stdout if some > > warning/error occurs. > > On my fresh system I get those writes because of two issues: > > - non existence of a username in ~/.hgrc for the user running apache > > - readding already added files > > > The one thing you can do is to capture sys.stdout in mercurial.py: > > commit, > > but that hides all messages/error writing from mercurial. > > The two issues can be resolved differently: > > - by checking for the .hgrc and setting HGUSER if it is not available > > - by using a .hgignore file and not adding an explicit list in > > mercurial.py but using hg addremove option (that is also much nicer > > when doing mercurial commands in the application directory from the > > commandline as it hides all the non-tracked data) > > > I can provide a patch if there is interest in this way of solving this > > issue > > Read the documentation: > > http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Writing_To_St... > > and my blog posts about it: > > http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output... > > Make sure you also aren't using an old mod_wsgi version. > > Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---