Show More
@@ -2073,26 +2073,6 b' Currently the magic system has the following functions:\\n"""' | |||||
2073 | f.write(cmds.encode("utf-8")) |
|
2073 | f.write(cmds.encode("utf-8")) | |
2074 | print 'The following commands were written to file `%s`:' % fname |
|
2074 | print 'The following commands were written to file `%s`:' % fname | |
2075 | print cmds |
|
2075 | print cmds | |
2076 |
|
||||
2077 | def magic_pastebin(self, parameter_s = ''): |
|
|||
2078 | """Upload code to the 'Lodge it' paste bin, returning the URL.""" |
|
|||
2079 | pbserver = ServerProxy('http://paste.pocoo.org/xmlrpc/') |
|
|||
2080 | code = self.extract_input_lines(parameter_s) |
|
|||
2081 | if not code: |
|
|||
2082 | try: |
|
|||
2083 | codeobj = eval(parameter_s, self.shell.user_ns) |
|
|||
2084 | except Exception: |
|
|||
2085 | codeobj = None |
|
|||
2086 | if isinstance(codeobj, str): |
|
|||
2087 | code = codeobj |
|
|||
2088 | elif isinstance(codeobj, Macro): |
|
|||
2089 | code = codeobj.value |
|
|||
2090 | else: |
|
|||
2091 | print parameter_s, ("was not recognised as a history range, nor" |
|
|||
2092 | " as a string or macro.") |
|
|||
2093 | return |
|
|||
2094 | id = pbserver.pastes.newPaste("python", code) |
|
|||
2095 | return "http://paste.pocoo.org/show/" + id |
|
|||
2096 |
|
2076 | |||
2097 | def _edit_macro(self,mname,macro): |
|
2077 | def _edit_macro(self,mname,macro): | |
2098 | """open an editor with the macro data in a file""" |
|
2078 | """open an editor with the macro data in a file""" |
General Comments 0
You need to be logged in to leave comments.
Login now