bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def __init__(self, action_name='_action_'): self.action_name = action_name
def __init__(self, action_name='_action_', default_action=None): self.action_name = action_name
33,100
def find_method(self, servlet, ret_value): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: return event.Continue if len(poss...
def find_method(self, servlet, ret_value, **kw): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: return event.Continue if le...
33,101
def find_method(self, servlet, ret_value): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: return event.Continue if len(poss...
def find_method(self, servlet, ret_value): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: if self.default_action: possible_...
33,102
def find_method(self, servlet, ret_value): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: return event.Continue if len(poss...
def find_method(self, servlet, ret_value): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: return event.Continue if len(poss...
33,103
def find_method(self, servlet, ret_value): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: return event.Continue if len(poss...
def find_method(self, servlet, ret_value): possible_actions = [] for name, value in servlet.fields.items(): if name == self.action_name: possible_actions.append(value) elif name.startswith(self.action_name): possible_actions.append(name[len(self.action_name):]) if not possible_actions: return event.Continue if len(poss...
33,104
def __init__(self, *args, **kwargs): assert self.app_obj, "must set app_obj" assert self.prefix, "must set prefix" args = (self,) + args scgi_server.SCGIHandler.__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): assert self.app_obj, "must set app_obj" assert self.prefix is not None, "must set prefix" args = (self,) + args scgi_server.SCGIHandler.__init__(*args, **kwargs)
33,105
def __init__(self, app, secret, cookie_name='auth_tkt', secure=False, include_ip=True): self.app = app self.secret = secret self.cookie_name = cookie_name self.secure = secure self.include_ip = include_ip
def __init__(self, app, secret, cookie_name='auth_tkt', secure=False, include_ip=True, logout_path=None): self.app = app self.secret = secret self.cookie_name = cookie_name self.secure = secure self.include_ip = include_ip
33,106
def __call__(self, environ, start_response): cookies = request.get_cookies(environ) if cookies.has_key(self.cookie_name): cookie_value = cookies[self.cookie_name].value else: cookie_value = '' if cookie_value: if self.include_ip: remote_addr = environ['REMOTE_ADDR'] else: # mod_auth_tkt uses this dummy value when IP is...
def __call__(self, environ, start_response): cookies = request.get_cookies(environ) if cookies.has_key(self.cookie_name): cookie_value = cookies[self.cookie_name].value else: cookie_value = '' if cookie_value: if self.include_ip: remote_addr = environ['REMOTE_ADDR'] else: # mod_auth_tkt uses this dummy value when IP is...
33,107
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
33,108
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
33,109
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
33,110
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
def handle_exception(exc_info, conf, error_stream, html=True): """ You can also use exception handling outside of a web context, like:: import sys import paste import paste.error_middleware try: do stuff except: paste.error_middleware.exception_handler( sys.exc_info(), paste.CONFIG, sys.stderr, html=False) If you wan...
33,111
def parse_formvars(environ, all_as_list=False, include_get_vars=True): """ Parses the request, returning a dictionary of the keys. If ``all_as_list`` is true, then all values will be lists. If not, then only values that show up multiple times will be lists. If ``include_get_vars`` is true and this was a POST request...
def parse_formvars(environ, all_as_list=False, include_get_vars=True): """Parses the request, returning a dictionary of the keys. If ``all_as_list`` is true, then all values will be lists. If not, then only values that show up multiple times will be lists. If ``include_get_vars`` is true and this was a POST request,...
33,112
def construct_url(environ, with_query_string=True, with_path_info=True, script_name=None, path_info=None, querystring=None): """ Reconstructs the URL from the WSGI environment. You may override SCRIPT_NAME, PATH_INFO, and QUERYSTRING with the keyword arguments. """ url = environ['wsgi.url_scheme']+'://' if environ.ge...
def construct_url(environ, with_query_string=True, with_path_info=True, script_name=None, path_info=None, querystring=None): """Reconstructs the URL from the WSGI environment. You may override SCRIPT_NAME, PATH_INFO, and QUERYSTRING with the keyword arguments. """ url = environ['wsgi.url_scheme']+'://' if environ.ge...
33,113
def get_data_files(path, files = []): l = [] for name in os.listdir(path): if name[0] == ".": continue relpath = os.path.join(path, name) f = os.path.join(BASEDIR, relpath) if os.path.isdir(f): get_data_files(relpath, files) elif os.path.isfile(f): l.append(f) pref = sysconfig.get_python_lib()[len(sysconfig.PREFIX) + 1...
def get_data_files(path, files = []): l = [] for name in os.listdir(path): if name[0] == ".": continue relpath = os.path.join(path, name) f = os.path.join(BASEDIR, relpath) if os.path.isdir(f): get_data_files(relpath, files) elif os.path.isfile(f): l.append(f) pref = sysconfig.get_python_lib()[len(sysconfig.PREFIX) + 1...
33,114
def __call__(self, environ, start_response): cookies = request.get_cookies(environ) if cookies.has_key(self.cookie_name): cookie_value = cookies[self.cookie_name].value else: cookie_value = '' if cookie_value: if self.include_ip: remote_addr = environ['REMOTE_ADDR'] else: # mod_auth_tkt uses this dummy value when IP is...
defenviron['REMOTE_USER_TOKENS'] = tokens __call__(self,environ['REMOTE_USER_TOKENS'] = tokens environ,environ['REMOTE_USER_TOKENS'] = tokens start_response):environ['REMOTE_USER_TOKENS'] = tokens cookiesenviron['REMOTE_USER_TOKENS'] = tokens =environ['REMOTE_USER_TOKENS'] = tokens request.get_cookies(environ)environ['...
33,115
def do_process(self, request): """Handle the redirect from the OpenID server. """ oidconsumer = self.oidconsumer
def do_process(self, request): """Handle the redirect from the OpenID server. """ oidconsumer = self.oidconsumer
33,116
def do_process(self, request): """Handle the redirect from the OpenID server. """ oidconsumer = self.oidconsumer
def do_process(self, request): """Handle the redirect from the OpenID server. """ oidconsumer = self.oidconsumer
33,117
def _parse_action(self): self.action = None for match in self._tag_re.finditer(self.text): end = match.group(1) == '/' tag = match.group(2).lower() if tag != 'form': continue attrs = _parse_attrs(match.group(3)) self.action = attrs.get('action', '') self.method = attrs.get('method', 'GET') self.id = attrs.get('id') # @...
def _parse_action(self): self.action = None for match in self._tag_re.finditer(self.text): end = match.group(1) == '/' tag = match.group(2).lower() if tag != 'form': continue attrs = _parse_attrs(match.group(3)) self.action = attrs.get('action', '') self.method = attrs.get('method', 'GET') self.id = attrs.get('id') # @...
33,118
def key(app_desc): (domain, url), app = app_desc if not domain: # Make sure empty domains sort last: return -len(url), '\xff' else: return -len(url), domain
def key(app_desc): (domain, url), app = app_desc if not domain: # Make sure empty domains sort last: return '\xff', -len(url) else: return -len(url), domain
33,119
def key(app_desc): (domain, url), app = app_desc if not domain: # Make sure empty domains sort last: return -len(url), '\xff' else: return -len(url), domain
def key(app_desc): (domain, url), app = app_desc if not domain: # Make sure empty domains sort last: return -len(url), '\xff' else: return -len(url), domain
33,120
def __call__(self, environ, start_response): app_iter = None reg = environ.setdefault('paste.registry', Registry()) reg.prepare() try: app_iter = self.application(environ, start_response) finally: if app_iter is None: # An error occurred... reg.cleanup() if type(app_iter) in (list, tuple): # Because it is a concrete it...
def __call__(self, environ, start_response): app_iter = None reg = environ.setdefault('paste.registry', Registry()) reg.prepare() try: app_iter = self.application(environ, start_response) finally: if app_iter is None: # An error occurred... reg.cleanup() if type(app_iter) in (list, tuple): # Because it is a concrete it...
33,121
def capture_output(environ, start_response, application): """ Runs application with environ and start_response, and captures status, headers, and body. Sends status and header, but *not* body. Returns (status, headers, body). Typically this is used like: ..code-block:: Python def dehtmlifying_middleware(applicatio...
def capture_output(environ, start_response, application): """ Runs application with environ and start_response, and captures status, headers, and body. Sends status and header, but *not* body. Returns (status, headers, body). Typically this is used like: .. code-block:: Python def dehtmlifying_middleware(applicati...
33,122
def intercept_output(environ, application, conditional=None, start_response=None): """ Runs application with environ and captures status, headers, and body. None are sent on; you must send them on yourself (unlike ``capture_output``) Typically this is used like: ..code-block:: Python def dehtmlifying_middleware(app...
def intercept_output(environ, application, conditional=None, start_response=None): """ Runs application with environ and captures status, headers, and body. None are sent on; you must send them on yourself (unlike ``capture_output``) Typically this is used like: .. code-block:: Python def dehtmlifying_middleware(ap...
33,123
def replacement_app(environ, start_response): status, headers, body = intercept_output( environ, application) content_type = header_value(headers, 'content-type') if (not content_type or not content_type.startswith('text/html')): return [body] body = re.sub(r'<.*?>', '', body) return [body]
def replacement_app(environ, start_response): status, headers, body = intercept_output( environ, application) content_type = header_value(headers, 'content-type') if (not content_type or not content_type.startswith('text/html')): return [body] body = re.sub(r'<.*?>', '', body) return [body]
33,124
def initialize(self): """Initialize coordinate system.""" import spatialdata.geocoords.geocoords as bindings bindings.CppCSGeoLocalCart_origin(self._cppCoordSys, self.originLon, self.originLat, self.originElev)
def initialize(self): """Initialize coordinate system.""" import spatialdata.geocoords.geocoords as bindings bindings.CppCSGeoLocalCart_origin(self._cppCoordSys, self.originLon, self.originLat, self.originElev)
33,125
def initialize(self): """Initialize coordinate system.""" import spatialdata.geocoords.geocoords as bindings bindings.CppCSGeoLocalCart_origin(self._cppCoordSys, self.originLon, self.originLat, self.originElev)
def initialize(self): """Initialize coordinate system.""" import spatialdata.geocoords.geocoords as bindings bindings.CppCSGeoLocalCart_origin(self._cppCoordSys, self.originLon, self.originLat, self.originElev)
33,126
def __init__(self, name="simpledb"): """Constructor.""" SpatialDB.__init__(self, name) self._cppSpatialDB = bindings.CppSimpleDB() return
def __init__(self, name="simpledb"): """Constructor.""" SpatialDB.__init__(self, name) self._cppSpatialDB = bindings.CppSimpleDB() return
33,127
def __init__(self, name="simpledb"): """Constructor.""" SpatialDB.__init__(self, name) self._cppSpatialDB = bindings.CppSimpleDB() return
def __init__(self, name="simpledb"): """Constructor.""" SpatialDB.__init__(self, name) self._cppSpatialDB = bindings.CppSimpleDB() return
33,128
def __init__(self, name="geocoordsys"): """Constructor.""" Component.__init__(self, name, facility="geocoordsys")
def __init__(self, name="geocoordsys"): """Constructor.""" Component.__init__(self, name, facility="geocoordsys")
33,129
def __build_search_suffixes(self): "Construct arch & kernel-versioning search suffixes." ss = set()
def __build_search_suffixes(self): "Construct arch & kernel-versioning search suffixes." ss = set()
33,130
def getFoafFromSha(self, mail_sha1sum): """ Services to obtain FOAF URI from an email sha1sum @param mail: an email address sha1sum @type mail: string @return: the FOAF URI of this email owner @rtype: string @todo: customize FOAF service """ # TODO: customize this with a real service # # ideas: - PyGoogle <h...
def getFoafFromSha(self, mail_sha1sum): """ Services to obtain FOAF URI from an email sha1sum @param mail_sha1sum: an email address sha1sum @type mail_sha1sum: string @return: the FOAF URI of this email owner @rtype: string @todo: customize FOAF service """ # TODO: customize this with a real service # # idea...
33,131
def toRDF(self): """Dump inde to RDF file"""
def toRDF(self): """Dump inde to RDF file"""
33,132
def __toRDF(self): """Dump to RDF file all subscribers""" if not (os.path.exists(self.config.get('dir'))): os.mkdir(self.config.get('dir'))
def __toRDF(self): """Dump to RDF file all subscribers""" if not (os.path.exists(self.config.get('dir'))): os.mkdir(self.config.get('dir'))
33,133
def publish(self): """ Publish the messages """ self.__createDir() #fisrt lap self.__parse() #and second lap mbox = Mbox(self.config.get('mbox')) messages = 0
def publish(self): """ Publish the messages """ self.__createDir() #fisrt lap self.__parse() #and second lap mbox = Mbox(self.config.get('mbox')) messages = 0
33,134
def args(self, argv, config): "Getting params"
def args(self, argv, config): "Getting params"
33,135
def goButtonClicked(self): uri = widgets.get_widget('urlInput').get_text() if (uri != ''): gsr.reset() gsr.messageBar( 'query on ' + uri) gsr.drawTree(gsr.getPosts(uri))
def goButtonClicked(self): uri = widgets.get_widget('urlInput').get_text() if (uri != ''): gsr.clear() gsr.clearSearchForm() gsr.messageBar( 'query on ' + uri) gsr.drawTree(gsr.getPosts(uri))
33,136
def reset(self): #tree self.treeTranslator = {} for column in self.treeView.get_columns(): self.treeView.remove_column(column)
def clear(self): #tree self.treeTranslator = {} for column in self.treeView.get_columns(): self.treeView.remove_column(column)
33,137
def reset(self): #tree self.treeTranslator = {} for column in self.treeView.get_columns(): self.treeView.remove_column(column)
def reset(self): #tree self.treeTranslator = {} for column in self.treeView.get_columns(): self.treeView.remove_column(column)
33,138
def reset(self): #tree self.treeTranslator = {} for column in self.treeView.get_columns(): self.treeView.remove_column(column)
def reset(self): #tree self.treeTranslator = {} for column in self.treeView.get_columns(): self.treeView.remove_column(column)
33,139
def toRDF(self, message, n): """Print a message into RDF in XML format""" msg = message template = Template() tpl = template.get('rdf_message')
def toRDF(self, message, n): """Print a message into RDF in XML format""" msg = message template = Template() tpl = template.get('rdf_message')
33,140
def toRDF(self, message, n): """Print a message into RDF in XML format""" msg = message template = Template() tpl = template.get('rdf_message')
def toRDF(self, message, n): """Print a message into RDF in XML format""" msg = message template = Template() tpl = template.get('rdf_message')
33,141
def toRDF(self, message, n): """Print a message into RDF in XML format""" msg = message template = Template() tpl = template.get('rdf_message')
def toRDF(self, message, n): """Print a message into RDF in XML format""" msg = message template = Template() tpl = template.get('rdf_message')
33,142
def __toRDF(self): """Dump to RDF file all suscriptors""" if not (os.path.exists(self.config.get('dir'))): os.mkdir(self.config.get('dir'))
def__toRDF(self):"""DumptoRDFfileallsuscriptors"""ifnot(os.path.exists(self.config.get('dir'))):os.mkdir(self.config.get('dir'))
33,143
def loadAdditionalData(self, uri): for post in self.graph.objects(uri, SIOC['container_of']): if not self.hasValueForPredicate(post, SIOC['title']): print 'Resolving reference to get additional data (', post, ')...', self.graph.parse(post) print 'OK, now', len(self.graph), 'triples' for user in self.graph.objects(uri...
def loadAdditionalData(self): for post in self.graph.objects(self.uri, SIOC['container_of']): if not self.hasValueForPredicate(post, SIOC['title']): print 'Resolving reference to get additional data (', post, ')...', self.graph.parse(post) print 'OK, now', len(self.graph), 'triples' for user in self.graph.objects(uri...
33,144
def loadAdditionalData(self, uri): for post in self.graph.objects(uri, SIOC['container_of']): if not self.hasValueForPredicate(post, SIOC['title']): print 'Resolving reference to get additional data (', post, ')...', self.graph.parse(post) print 'OK, now', len(self.graph), 'triples' for user in self.graph.objects(uri...
def loadAdditionalData(self, uri): for post in self.graph.objects(uri, SIOC['container_of']): if not self.hasValueForPredicate(post, SIOC['title']): print 'Resolving reference to get additional data (', post, ')...', self.graph.parse(post) print 'OK, now', len(self.graph), 'triples' for user in self.graph.objects(sel...
33,145
def query(self): try: self.graph = self.loadMailingList(self.uri) self.loadAdditionalData(self.uri) print 'Total triples loaded:', len(self.graph) sparqlGr = sparql.sparqlGraph.SPARQLGraph(self.graph) select = ('?post', '?id', '?postTitle', '?userName') where = sparql.GraphPattern([('?post', RDF['type'], SIOC['Pos...
def query(self): try: self.graph = self.loadMailingList(self.uri) self.loadAdditionalData(self.uri) print 'Total triples loaded:', len(self.graph) sparqlGr = sparql.sparqlGraph.SPARQLGraph(self.graph) select = ('?post', '?postTitle', '?userName', '?parent') where = sparql.GraphPattern([('?post', RDF['type'], SIOC[...
33,146
def query(self): try: self.graph = self.loadMailingList(self.uri) self.loadAdditionalData(self.uri) print 'Total triples loaded:', len(self.graph) sparqlGr = sparql.sparqlGraph.SPARQLGraph(self.graph) select = ('?post', '?id', '?postTitle', '?userName') where = sparql.GraphPattern([('?post', RDF['type'], SIOC['Pos...
def query(self): try: self.graph = self.loadMailingList(self.uri) self.loadAdditionalData(self.uri) print 'Total triples loaded:', len(self.graph) sparqlGr = sparql.sparqlGraph.SPARQLGraph(self.graph) select = ('?post', '?id', '?postTitle', '?userName') where = sparql.GraphPattern([('?post', RDF['type'], SIOC['Pos...
33,147
def drawTree(self, url): self.cache = Cache(url) posts = self.cache.query() if (posts!=None and len(posts)>0): #create view and model self.treeView = widgets.get_widget('postsTree') self.treeStore = gtk.TreeStore(str) self.treeView.set_model(self.treeStore) #append items parent = None for (post, id, title, creator) ...
def drawTree(self, url): self.cache = Cache(url) posts = self.cache.query() if (posts!=None and len(posts)>0): #create view and model self.treeView = widgets.get_widget('postsTree') self.treeStore = gtk.TreeStore(str) self.treeView.set_model(self.treeStore) #append items parent = None for (post, title, creator, pare...
33,148
def __getParent(self, id): if (id in self.treeTranslator): return self.treeTranslator[id] else: return None
def __getParent(self, uri): if (uri in self.treeTranslator): return self.treeTranslator[uri] else: return None
33,149
def __init__(self): self.treeTranslator = {} #statusbar self.statusbar = widgets.get_widget('gsrStatusbar') self.messageBar('ready') #main window self.window = widgets.get_widget('gsr') self.window.set_icon_from_file('rdf.ico') self.window.show()
def __init__(self): self.treeTranslator = {} #statusbar self.statusbar = widgets.get_widget('gsrStatusbar') self.messageBar('ready') #main window self.window = widgets.get_widget('gsr') self.window.set_icon_from_file('rdf.ico') self.window.show()
33,150
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.messageId = msg['Message-Id'] self.date = msg['Date'] self.From = msg['From'] self.getAddressFrom = msg.getaddr('From') self.to = msg['To'] #tip because decode_header returns the exception # ValueError...
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.messageId = msg['Message-Id'] self.date = msg['Date'] self.From = msg['From'] self.getAddressFrom = msg.getaddr('From') self.to = msg['To'] #tip because decode_header returns the exception # ValueError...
33,151
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.messageId = msg['Message-Id'] self.date = msg['Date'] self.From = msg['From'] self.getAddressFrom = msg.getaddr('From') self.to = msg['To'] #tip because decode_header returns the exception # ValueError...
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.messageId = msg['Message-Id'] self.date = msg['Date'] self.From = msg['From'] self.getAddressFrom = msg.getaddr('From') self.to = msg['To'] #tip because decode_header returns the exception # ValueError...
33,152
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.messageId = msg['Message-Id'] self.date = msg['Date'] self.From = msg['From'] self.getAddressFrom = msg.getaddr('From') self.to = msg['To'] #tip because decode_header returns the exception # ValueError...
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.messageId = msg['Message-Id'] self.date = msg['Date'] self.From = msg['From'] self.getAddressFrom = msg.getaddr('From') self.to = msg['To'] #tip because decode_header returns the exception # ValueError...
33,153
def getTo(self): to = ' ' try: to = self.to except: #some mails have not a 'to' field to = self.config.get('defaultTo') to = to.replace('@', self.config.getAntiSpam()) to = to.replace('<', '') to = to.replace('>', '') return unicode(to, errors='ignore')
def getTo(self): to = ' ' try: to = self.to except: #some mails have not a 'to' field to = self.config.get('defaultTo') to = to.replace('@', self.config.getAntiSpam()) to = to.replace('<', '') to = to.replace('>', '') return unicode(to, errors='ignore')
33,154
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.msg = msg self.config = config
def __init__(self, msg, config): """Message constructor""" self.__class__.id += 1 self.id = self.__class__.id self.messageId = msg['Message-Id'] self.date = msg['Date'] self.From = msg['From'] self.getAddressFrom = msg.getaddr('From') self.to = msg['To'] subject_parted = msg['Subject'].split(' ') subject = '' for o...
33,155
def getSwamlId(self): #TODO: obtain a better SWAML ID parted_id = self.msg['Message-Id'].split('.') msg_id = parted_id[len(parted_id)-1] + '-' + self.msg['Date'] + '-swaml-' + str(self.id) return sha.new(msg_id).hexdigest()
def getSwamlId(self): #TODO: obtain a better SWAML ID parted_id = self.messageId.split('.') msg_id = parted_id[len(parted_id)-1] + '-' + self.date + '-swaml-' + str(self.id) return sha.new(msg_id).hexdigest()
33,156
def getPath(self): """Return the message's index name"""
def getPath(self): """Return the message's index name"""
33,157
def getFromName(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[0]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_name
def getFromName(self): if(self.From.find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[0]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_name
33,158
def getFromName(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[0]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_name
def getFromName(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.getAddressFrom[0]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_name
33,159
def getFromName(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[0]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_name
def getFromName(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[0]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.From) return from_name
33,160
def getFromMail(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[1]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_mail
def getFromMail(self): if(self.From.find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[1]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_mail
33,161
def getFromMail(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[1]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_mail
def getFromMail(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.getAddressFrom[1]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_mail
33,162
def getFromMail(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[1]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.msg['From']) return from_mail
def getFromMail(self): if(self.msg['From'].find('<')!= -1): #mail similar than: Name Surmane <name@domain.com> return str(self.msg.getaddr('From')[1]) else: #something like: Name Surmane name@domain.com from_name, from_mail = self.parseFrom(self.From) return from_mail
33,163
def getTo(self): to = ' ' try: to = self.msg['To'] except: #some mails have not a 'to' field to = self.config.get('defaultTo') to = to.replace('@', self.config.getAntiSpam()) to = to.replace('<', '') to = to.replace('>', '') return unicode(to, errors='ignore')
def getTo(self): to = ' ' try: to = self.to except: #some mails have not a 'to' field to = self.config.get('defaultTo') to = to.replace('@', self.config.getAntiSpam()) to = to.replace('<', '') to = to.replace('>', '') return unicode(to, errors='ignore')
33,164
def getSubject(self): return unicode(self.msg['Subject'], errors='ignore')
def getSubject(self): return self.subject
33,165
def getDate(self): return self.msg['Date']
def getDate(self): return self.date
33,166
def getBody(self): return unicode(self.msg.fp.read(), errors='ignore')
def getBody(self): return self.body
33,167
def version(self): print "SWAML", __init__.__version__ sys.exit()
def version(self): print "SWAML 0.0.5", sys.exit()
33,168
def args(self, argv, config): "Getting params of default input"
def args(self, argv, config): "Getting params of default input"
33,169
def args(self, argv, config): "Getting params of default input"
def args(self, argv, config): "Getting params of default input"
33,170
def args(self, argv, config): "Getting params of default input"
def args(self, argv, config): "Getting params of default input"
33,171
def args(self, argv, config): "Getting params of default input"
def args(self, argv, config): "Getting params of default input"
33,172
def destroy(self): if (self.cache != None): self.cache.dump()
def destroy(self): if (self.cache != None): self.cache.dump()
33,173
def main(self, uri=None): #widgets self.treeView = widgets.get_widget('postsTree') self.text = widgets.get_widget('buxonTextView') buffer = self.text.get_buffer() self.insertBufferTag(buffer, 'bold', 'weight', pango.WEIGHT_BOLD) self.insertBufferTag(buffer, 'monospace', 'family', 'monospace') self.insertBufferTag(buff...
def main(self, uri=None): #widgets self.treeView = widgets.get_widget('postsTree') self.text = widgets.get_widget('buxonTextView') buffer = self.text.get_buffer() self.insertBufferTag(buffer, 'bold', 'weight', pango.WEIGHT_BOLD) self.insertBufferTag(buffer, 'monospace', 'family', 'monospace') self.insertBufferTag(buff...
33,174
def __init__(self): GtkUI.__init__(self, 'buxon') self.cache = None self.treeTranslator = {}
def __init__(self, base): GtkUI.__init__(self, 'buxon') self.cache = None self.treeTranslator = {}
33,175
def __init__(self): GtkUI.__init__(self, 'buxon') self.cache = None self.treeTranslator = {}
def __init__(self): GtkUI.__init__(self, 'buxon') self.cache = None self.treeTranslator = {}
33,176
def __init__(self): GtkUI.__init__(self, 'buxon') self.cache = None self.treeTranslator = {}
def __init__(self): GtkUI.__init__(self, 'buxon') self.cache = None self.treeTranslator = {}
33,177
def __init__(self, argv, base=None): """ All operation that Buxon need to run """ try: global widgets global callbacks global buxon if (base == None): path = __file__.split('/') base = '/'.join(path[:-1]) + '/' widgets = ObjectBuilder(base + 'includes/ui/graphical/buxon.glade') callbacks = Callbacks() widgets.signal...
def __init__(self, argv, base=None): """ All operation that Buxon need to run """ try: global widgets global callbacks global buxon if (base == None): path = __file__.split('/') base = '/'.join(path[:-1]) + '/' widgets = ObjectBuilder(base + 'includes/ui/graphical/buxon.glade') callbacks = Callbacks() widgets.signal...
33,178
def __getGraph(self, foaf): """ A simple mechanism to cache foaf graph """ if (self.__actualFoaf != foaf or self.__graph == None): self.__actualFoaf = foaf self.__graph = sparqlGraph.SPARQLGraph() try: self.__graph.parse(foaf) except: self.__graph = None
def __getGraph(self, foaf): """ A simple mechanism to cache foaf graph """ if (self.__actualFoaf != foaf or self.__graph == None): self.__actualFoaf = foaf self.__graph = sparqlGraph.SPARQLGraph() try: self.__graph.parse(foaf) except: self.__graph = None
33,179
def getFoaf(self, mail): """ Services to obtain FOAF URI from an email address @param mail: an email address @type mail: string @return: the FOAF URI of this email owner @rtype: string @todo customize foaf service """ mail_sha1sum = self.getShaMail(mail) # TODO: customize this with a real service # # ideas:...
def getFoaf(self, mail): """ Services to obtain FOAF URI from an email address @param mail: an email address @type mail: string @return: the FOAF URI of this email owner @rtype: string @todo customize foaf service """ mail_sha1sum = self.getShaMail(mail) # TODO: customize this with a real service # # ideas:...
33,180
def addIndex(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_index_item')
def addIndex(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_index_item')
33,181
def addIndex(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_index_item')
def addIndex(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_index_item')
33,182
def intoRDF(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_message')
def intoRDF(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_message')
33,183
def intoRDF(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_message')
def intoRDF(self, message, n): self.msg = message self.template = Template() self.tpl = self.template.get('rdf_message')
33,184
def __init__(self, uri): self.uri = uri self.graph = self.loadMailingList(self.uri) self.loadAdditionalData(self.uri) print 'Total triples loaded:', len(self.graph)
def __init__(self, uri): self.uri = uri self.bad = False try: self.graph = self.loadMailingList(self.uri) except Exception, details: print '\nAn exception ocurred parsing ' + uri + ': ' + str(details) self.bad = True return self.loadAdditionalData() print 'Total triples loaded:', len(self.graph)
33,185
def getPosts(self, uri, min=None, max=None, text=None): if (self.cache == None): self.cache = Cache(uri) else: if (uri != self.cache.uri): self.cache = Cache(uri) min, max = self.getDates() posts = self.cache.query() if (min!=None or max!=None or text!=None): posts = self.cache.filterPosts(posts, min, max, text) ret...
def getPosts(self, uri, min=None, max=None, text=None): if (self.cache == None): self.cache = Cache(uri) else: if (uri!=self.cache.uri or self.cache.bad): self.cache = Cache(uri) min, max = self.getDates() posts = self.cache.query() if (min!=None or max!=None or text!=None): posts = self.cache.filterPosts(posts, min,...
33,186
def getPosts(self, uri, min=None, max=None, text=None): if (self.cache == None): self.cache = Cache(uri) else: if (uri != self.cache.uri): self.cache = Cache(uri) min, max = self.getDates() posts = self.cache.query() if (min!=None or max!=None or text!=None): posts = self.cache.filterPosts(posts, min, max, text) ret...
def getPosts(self, uri, min=None, max=None, text=None): if (self.cache == None): self.cache = Cache(uri) else: if (uri != self.cache.uri): self.cache = Cache(uri) min, max = self.getDates() posts = self.cache.query() if (min!=None or max!=None or text!=None): posts = self.cache.filterPosts(posts, min, max, text) ret...
33,187
def dumpTranslation(self): try: f = open(self.translationFile, 'w') for url in self.translation.keys(): title = self.translation[url] f.write(url + ' ' + title) f.close() print 'dumped URL\'s cache in', self.destinationFile except IOError, details: print 'Problem writing translation cache: ' + str(details)
def dumpTranslation(self): try: f = open(self.translationFile, 'w') for url in self.translation.keys(): title = self.translation[url] f.write(url + ' ' + title + '\n') f.close() print 'dumped URL\'s cache in', self.destinationFile except IOError, details: print 'Problem writing translation cache: ' + str(details)
33,188
def dumpTranslation(self): try: f = open(self.translationFile, 'w') for url in self.translation.keys(): title = self.translation[url] f.write(url + ' ' + title) f.close() print 'dumped URL\'s cache in', self.destinationFile except IOError, details: print 'Problem writing translation cache: ' + str(details)
def dumpTranslation(self): try: f = open(self.translationFile, 'w') for url in self.translation.keys(): title = self.translation[url] f.write(url + ' ' + title) f.close() print 'dumped URL\'s cache in', self.translationFile except IOError, details: print 'Problem writing translation cache: ' + str(details)
33,189
def encode(self, orig): """ Encode an string @param orig: original string """ ret = '' try: ret = self.__force_decode(orig) except Exception: ret = self.__unicode(orig, self.charset) return ret
def encode(self, orig): """ Encode an string @param orig: original string """ ret = '' try: ret = self.__unicode(orig, self.charset) except Exception: ret = self.__unicode(orig, self.charset) return ret
33,190
def encode(self, orig): """ Encode an string @param orig: original string """ ret = '' try: ret = self.__force_decode(orig) except Exception: ret = self.__unicode(orig, self.charset) return ret
def encode(self, orig): """ Encode an string @param orig: original string """ ret = '' try: ret = self.__force_decode(orig) except Exception: ret = self.__decode(orig) return ret
33,191
def __decode(self, orig): """ Decode an string @param orig: original string """ #tip because decode_header returns the exception # ValueError: too many values to unpack #TODO: performance this tip parted = orig.split(' ') dest = '' for one in parted: [(s, enconding)] = decode_header(one) if (dest == ''): dest = s ...
def __decode(self, orig): """ Decode an string @param orig: original string """ #tip because decode_header returns the exception # ValueError: too many values to unpack #TODO: performance this tip parted = orig.split(' ') dest = '' for one in parted: [(s, enconding)] = decode_header(one) if (dest == ''): dest = s ...
33,192
def __init__(self, base='./'): """ Buxon constructor @param base: base directory """ GtkUI.__init__(self, 'buxon') self.base = base self.cache = None self.treeTranslator = {}
def __init__(self, base='./'): """ Buxon constructor @param base: base directory """ GtkUI.__init__(self, 'buxon', base) self.base = base self.cache = None self.treeTranslator = {}
33,193
def list(self, sort=None, group=None, filter=None, columns=None, filterspec=None, show_customization=None, show_nodes=1, pagesize=None): ''' call the template index with the args
def list(self, sort=None, group=None, filter=None, columns=None, filterspec=None, show_customization=None, show_nodes=1, pagesize=None): ''' call the template index with the args
33,194
def _createnode(self): ''' create a node based on the contents of the form ''' cl = self.db.classes[self.classname] props = parsePropsFromForm(self.db, cl, self.form)
def _createnode(self): ''' create a node based on the contents of the form ''' cl = self.db.classes[self.classname] props = parsePropsFromForm(self.db, cl, self.form)
33,195
def showfile(self): ''' display a file ''' nodeid = self.nodeid cl = self.db.file mime_type = cl.get(nodeid, 'type') if mime_type == 'message/rfc822': mime_type = 'text/plain' self.header(headers={'Content-Type': mime_type}) self.write(cl.get(nodeid, 'content'))
def showfile(self): ''' display a file ''' nodeid = self.nodeid cl = self.db.file mime_type = cl.get(nodeid, 'type') if mime_type == 'message/rfc822': mime_type = 'text/plain' self.header(headers={'Content-Type': mime_type}) self.write(cl.get(nodeid, 'content'))
33,196
def suite(): l = [ unittest.makeSuite(anydbmDBTestCase, 'test'), unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') ]
def suite(): l = [ unittest.makeSuite(anydbmDBTestCase, 'test'), unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test') ]
33,197
def create(self, **propvalues): """Create a new node of this class and return its id.
def create(self, **propvalues): """Create a new node of this class and return its id.
33,198
def create(self, **propvalues): """Create a new node of this class and return its id.
def create(self, **propvalues): """Create a new node of this class and return its id.
33,199