Strange lines for traceback modules

47 views
Skip to first unread message

Pierre Thibault

unread,
Mar 21, 2016, 7:21:28 PM3/21/16
to web2py-developers
I found in the code these lines in gluon/admin.py and I am wondering if it is not error:

        tb = traceback.format_exc(sys.exc_info) # Line 151
        return False, traceback.format_exc(sys.exc_info) # Line 170
        return False, traceback.format_exc(sys.exc_info) # Line 200

because help(traceback.format_exc) says:

format_exc(limit=None)
    Like print_exc() but return a string.

and help(traceback.print_exc):

print_exc(limit=None, file=None)
    Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'.
    (In fact, it uses sys.exc_info() to retrieve the same information
    in a thread-safe way.)

I don't understand because sys.exc_info is function and the parameter limit is expected to be an integer.

Are these errors?

Leonel Câmara

unread,
Mar 21, 2016, 8:55:10 PM3/21/16
to web2py-developers
Yes, yes they are. Make a pull request :)

It should be just traceback.format_exc()

One only needs to look at the code for traceback.format_exc to be sure:

def format_exc(limit=None, chain=True):

    """Like print_exc() but return a string."""
    return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))

Pierre Thibault

unread,
Mar 25, 2016, 12:19:07 PM3/25/16
to web2py-developers
I don't have to right to push a new branch. Can someone give me that right? Thank you.

Leonel Câmara

unread,
Mar 25, 2016, 1:02:20 PM3/25/16
to web2py-developers
That's not how you do it :) First you fork web2py so you have your own web2py repository. Don't ever do anything on this repository you will be syncing it regularly with web2py's official repository. Then, you make a branch of your own repository and make the changes there. Finally you make the pull request, don't worry, github is smart enough to make the pull request to the official web2py repository directly from your branch.

Pierre Thibault

unread,
Mar 25, 2016, 1:14:28 PM3/25/16
to web2py-d...@googlegroups.com
I don't understand. I made a clone of master. Then I created a branch from master to make my changes locally. I made my changes and then I committed on my new local branch.

Then how can I create a pull request for this new branch if I don't push it on Github? I don't understand what I should do. Can you help me?

2016-03-25 13:02 GMT-04:00 Leonel Câmara <leonel...@gmail.com>:
That's not how you do it :) First you fork web2py so you have your own web2py repository. Don't ever do anything on this repository you will be syncing it regularly with web2py's official repository. Then, you make a branch of your own repository and make the changes there. Finally you make the pull request, don't worry, github is smart enough to make the pull request to the official web2py repository directly from your branch.

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py-developers/-KhFIyGP09I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Leonel Câmara

unread,
Mar 25, 2016, 1:22:20 PM3/25/16
to web2py-developers
Yes, you're almost there

1. I made a clone of master.
2. Then I created a branch from master to make my changes locally. 
3. I made my changes and then I committed on my new local branch.

Now you need to push the changes to your branch, committing is not enough in git as it's only local, then on github you will see the option to make a pull request.

Pierre Thibault

unread,
Mar 25, 2016, 1:28:36 PM3/25/16
to web2py-d...@googlegroups.com
"Now you need to push the changes to your branch, committing is not enough in git as it's only local, then on github you will see the option to make a pull request."

This is what I don't understand. "Pushing my branch?" That is what I tried in the first place but I don't have the right to create news branches on the remote web2py repository. I am sorry. I am very confused.

--

Leonel Câmara

unread,
Mar 25, 2016, 2:57:52 PM3/25/16
to web2py-d...@googlegroups.com
Ok lets do this step by step

1. You create your own clone of web2py on GitHub, which GitHub calls "forking".



2. On this repository you create a branch



3. You create a local clone of this branch. I like to use tortoisegit for this



4. You make the changes locally, then you commit and push. You can use tortoisegit for this too.

5. You go to your branch on github, the option to do a pull request will be there.

6. If your pull request is accepted, your commit will be in the master branch of web2py.



Pierre Thibault

unread,
Mar 25, 2016, 4:01:54 PM3/25/16
to web2py-d...@googlegroups.com
Thank you Leonel, I was missing the fork part. Now, I understand. I made the pull request.

Do why have a wiki for the dev to put this kind of documentation? It would be nice to have a formal starting point for new developers. It may also help formalize the workflow and improve quality.

2016-03-25 14:57 GMT-04:00 Leonel Câmara <leonel...@gmail.com>:
Ok lets do this step by step

1. You create your own clone of web2py on GitHub, which GitHub calls "forking".



2. On this repository you create a branch



3. You create a local clone of this branch. I like to use tortoisegit for this



3. You make the changes locally, then you commit and push. You can use tortoisegit for this too.

4. You go to your branch on github, the option to do a pull request will be there.

5. If your pull request is accepted, your commit will be in the master branch of web2py.



Leonel Câmara

unread,
Mar 25, 2016, 4:10:42 PM3/25/16
to web2py-developers
Thank you for contributing!

Niphlod

unread,
Mar 25, 2016, 4:12:09 PM3/25/16
to web2py-developers
there's an entire section on the book: feel free to reword/enhance it.

Pierre Thibault

unread,
Mar 25, 2016, 4:18:06 PM3/25/16
to web2py-d...@googlegroups.com
The doc does not say to create a new branch. I guess it is optional. Everything seems to be there!

I'll read more and I'll do pull requests as needed.

Thank you.

Leonel Câmara

unread,
Mar 25, 2016, 5:32:28 PM3/25/16
to web2py-d...@googlegroups.com
Creating a new branch is a good idea because pull requests can take a while to be merged and you can keep the main one synced with upstream and then you branch as you add features. This makes it less likely to have conflicts and other problems.

Pierre Thibault

unread,
Mar 25, 2016, 5:48:01 PM3/25/16
to web2py-d...@googlegroups.com
This is what I was thinking. I'll add a new step in the book.

2016-03-25 17:32 GMT-04:00 Leonel Câmara <leonel...@gmail.com>:
Creating a new branch is a good idea because pull requests can take a while to be merge and you can keep the main one synced with upstream and then you branch as you add features. This makes it less likely to have conflicts and other problems.

Pierre Thibault

unread,
Mar 25, 2016, 6:06:55 PM3/25/16
to web2py-d...@googlegroups.com
Done!
Reply all
Reply to author
Forward
0 new messages