rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
Exception.__init__() | Exception.__init__(self) | def __init__(self, einfo, comp): Exception.__init__() self.einfo = einfo self.comp = comp |
msg = "%s:\n" % msg, second, first) | msg = "%s:\n" % msg | def DeepEq(self, first, second, msg=""): res = deep.compare(first, second) if msg: msg = "%s:\n" % msg, second, first) else: msg = "" if res: msg += "\nDiffered at " + res.render_full() self.failUnless(not res, msg) |
accum = [ tuple(line.split(':')) for line in self._accumulatedHeaders] | accum = [ tuple(line.split(':',1)) for line in self._accumulatedHeaders] | def getHeaders(self): """return the response headers as a list of tuples according to the WSGI spec """ response_headers = self._headers.items() accum = [ tuple(line.split(':')) for line in self._accumulatedHeaders] response_headers.extend(accum) return response_headers |
>>> from zope.testbrowser import Browser | >>> from zope.testbrowser.testing import Browser | def test_file_returns(): """We want to make sure that file returns work |
if not self.user_apps_reader: self.user_apps_reader = UserAppsReader() self.user_apps_reader.read() | def on_itemPreferences_activate(self, widget, *args): if not self.user_apps_reader: self.user_apps_reader = UserAppsReader() self.user_apps_reader.read() | |
self.ofile.write( '<description>'+item.description+'</description>'+"\n") | self.ofile.write( '<description><![CDATA['+item.description+']]></description>'+"\n") | def addItem( self, item): self.ofile.write( '<item>'+"\n") self.ofile.write( '<title>'+item.title+'</title>'+"\n") self.ofile.write( '<description>'+item.description+'</description>'+"\n") self.ofile.write( '<url>'+item.url+'</url>'+"\n") self.ofile.write( '</item>'+"\n") |
track.time_released = time.mktime(ipod_date) + 2082844800 | track.time_released = int(time.mktime(ipod_date) + 2082844800) | def add_episode_from_channel( self, channel, episode): if not ipod_supported(): return False if self.callback_status != None: channeltext = channel.title if channel.is_music_channel: channeltext = _('%s (to "%s")') % ( channel.title, channel.device_playlist_name ) gobject.idle_add( self.callback_status, episode.title, ... |
print "get download dir:", self, self.__download_dir | if libgpodder.isDebugging(): print "get_download_dir: ", self, self.__download_dir | def get_download_dir(self): print "get download dir:", self, self.__download_dir if self.__download_dir == None: return libgpodder.gPodderLib().downloaddir else: return self.__download_dir |
print "set download dir:", self, self.__download_dir | if libgpodder.isDebugging(): print "set_download_dir: ", self, self.__download_dir | def set_download_dir(self, value): self.__download_dir = value libgpodder.gPodderLib().createIfNecessary(self.__download_dir) print "set download dir:", self, self.__download_dir |
channel.sync_to_devices = not self.cbNoSync.get_active() channel.save_metadata_to_localdb() | if channel != None: channel.sync_to_devices = not self.cbNoSync.get_active() channel.save_metadata_to_localdb() | def requestURL( self, channel = None): if channel != None: self.entryURL.set_text( channel.url) self.downloadTo.set_text( channel.save_dir) self.channel_title.set_markup( "<b>%s</b>" % channel.title) channel.set_metadata_from_localdb() self.cbNoSync.set_active( not channel.sync_to_devices) description = channel.descrip... |
channel_filename = self.get_current_channel_downloaded() selection_tuple = self.treeDownloaded.get_selection().get_selected() selection_iter = selection_tuple[1] url = self.treeDownloaded.get_model().get_value( selection_iter, 0) if widget.get_name() == "treeDownloaded": podcast = self.ldb.get_podcast_by_podcast_url( ... | channel_filename = self.get_current_channel_downloaded() selection = self.treeDownloaded.get_selection() model = self.treeDownloaded.get_model() if selection.count_selected_rows() != 1: return selection_tuple = selection.get_selected_rows() apath = selection_tuple[1][0] selection_iter = model.get_iter( apath) url =... | def on_treeDownloaded_row_activated(self, widget, *args): if libgpodder.isDebugging(): print "on_treeDownloaded_row_activated called with self.%s" % widget.get_name() try: channel_filename = self.get_current_channel_downloaded() selection_tuple = self.treeDownloaded.get_selection().get_selected() selection_iter = sele... |
self.chlist.append( rdb.channel) | if len( rdb.channel) > 0: self.chlist.append( rdb.channel) | def getDownloadedChannelsList( self): # do not re-read downloaded channels list if self.chlist != None: if libgpodder.isDebugging(): print "(localDB) using cached downloaded channels list" return self.chlist self.chlist = [] ifl = self.getIndexFileList() for f in ifl: if isfile( f): # whew! found a index file, parse ... |
if len( channel) > 0: if libgpodder.isDebugging(): print "(getmodel) " + channel.title new_iter = new_model.append() new_model.set( new_iter, 0, channel.url) new_model.set( new_iter, 1, channel.title) | if libgpodder.isDebugging(): print "(getmodel) " + channel.title new_iter = new_model.append() new_model.set( new_iter, 0, channel.url) new_model.set( new_iter, 1, channel.title) | def getDownloadedChannelsModel( self): new_model = gtk.ListStore( gobject.TYPE_STRING, gobject.TYPE_STRING) for channel in self.getDownloadedChannelsList(): if len( channel) > 0: if libgpodder.isDebugging(): print "(getmodel) " + channel.title new_iter = new_model.append() new_model.set( new_iter, 0, channel.url) new_... |
print >> fd, ' <url>%s</url>' % chan.url print >> fd, ' <download_dir>%s</download_dir>' % chan.save_dir | print >> fd, ' <url>%s</url>' % saxutils.escape( chan.url) print >> fd, ' <download_dir>%s</download_dir>' % saxutils.escape( chan.save_dir) | def write( self, channels): filename = gPodderLib().getChannelsFilename() fd = open( filename, "w") print >> fd, '<!-- '+_('gPodder channel list')+' -->' print >> fd, '<channels>' for chan in channels: print >> fd, ' <channel name="%s">' % chan.filename print >> fd, ' <url>%s</url>' % chan.url print >> fd, ' <do... |
if len( desc) > 20: | if len( desc) > 80: | def one_line_description( self): lines = self.description.strip().splitlines() if not lines or lines[0] == '': return _('No description available') else: desc = lines[0].strip() if len( desc) > 20: return desc[:80] + '...' else: return desc |
self.downloaddir = gPodderLib().downloaddir self.directories = listdir( self.downloaddir) def getIndexFileList( self): if self.iflist != None: if libgpodder.isDebugging(): print "(localDB) using cached index file list" return self.iflist self.iflist = [] for d in self.directories: self.iflist.append( self.downloadd... | self.channel_list = None self.local_db_cache = {} | def __init__( self): if libgpodder.isDebugging(): print "created new localDB object" self.downloaddir = gPodderLib().downloaddir self.directories = listdir( self.downloaddir) |
if self.chlist != None: | if self.channel_list != None: | def getDownloadedChannelsList( self): # do not re-read downloaded channels list if self.chlist != None: if libgpodder.isDebugging(): print "(localDB) using cached downloaded channels list" return self.chlist self.chlist = [] ifl = self.getIndexFileList() for f in ifl: if isfile( f): # whew! found a index file, parse ... |
return self.chlist | return self.channel_list | def getDownloadedChannelsList( self): # do not re-read downloaded channels list if self.chlist != None: if libgpodder.isDebugging(): print "(localDB) using cached downloaded channels list" return self.chlist self.chlist = [] ifl = self.getIndexFileList() for f in ifl: if isfile( f): # whew! found a index file, parse ... |
self.chlist = [] | self.channel_list = [] | def getDownloadedChannelsList( self): # do not re-read downloaded channels list if self.chlist != None: if libgpodder.isDebugging(): print "(localDB) using cached downloaded channels list" return self.chlist self.chlist = [] ifl = self.getIndexFileList() for f in ifl: if isfile( f): # whew! found a index file, parse ... |
ifl = self.getIndexFileList() for f in ifl: | for d in listdir( gPodderLib().downloaddir): f = sep.join( [ gPodderLib().downloaddir, d, 'index.xml' ]) | def getDownloadedChannelsList( self): # do not re-read downloaded channels list if self.chlist != None: if libgpodder.isDebugging(): print "(localDB) using cached downloaded channels list" return self.chlist self.chlist = [] ifl = self.getIndexFileList() for f in ifl: if isfile( f): # whew! found a index file, parse ... |
if f in self.localdbs: rdb = self.localdbs[f] else: | if f not in self.local_db_cache: | def getDownloadedChannelsList( self): # do not re-read downloaded channels list if self.chlist != None: if libgpodder.isDebugging(): print "(localDB) using cached downloaded channels list" return self.chlist self.chlist = [] ifl = self.getIndexFileList() for f in ifl: if isfile( f): # whew! found a index file, parse ... |
self.localdbs[f] = rdb if len( rdb.channel) > 0: self.chlist.append( rdb.channel) | rdb.channel.set_filename( d) self.local_db_cache[f] = rdb if len( self.local_db_cache[f].channel) > 0: self.channel_list.append( self.local_db_cache[f].channel) | def getDownloadedChannelsList( self): # do not re-read downloaded channels list if self.chlist != None: if libgpodder.isDebugging(): print "(localDB) using cached downloaded channels list" return self.chlist self.chlist = [] ifl = self.getIndexFileList() for f in ifl: if isfile( f): # whew! found a index file, parse ... |
if filename in self.localdbs: rdb = self.localdbs[filename] else: rdb = readLocalDB() rdb.parseXML( filename) self.localdbs[filename] = rdb | if filename not in self.local_db_cache: self.clear_cache() self.getDownloadedChannelsList() | def get_rdb_by_filename( self, filename): if filename in self.localdbs: rdb = self.localdbs[filename] else: rdb = readLocalDB() rdb.parseXML( filename) self.localdbs[filename] = rdb return rdb |
return rdb | return self.local_db_cache[filename] | def get_rdb_by_filename( self, filename): if filename in self.localdbs: rdb = self.localdbs[filename] else: rdb = readLocalDB() rdb.parseXML( filename) self.localdbs[filename] = rdb return rdb |
ipod_functions( False) | self.ipod_functions( False) | def new(self): if libgpodder.isDebugging(): print "A new %s has been created" % self.__class__.__name__ |
files = listdir( dir) for file in files: self.parse_and_append( dir, file) | for file in glob( dir+'/*.desktop'): self.parse_and_append( file) | def read( self): for dir in userappsdirs: if exists( dir): files = listdir( dir) for file in files: self.parse_and_append( dir, file) self.apps.append( UserApplication( 'Shell command', '', 'audio/*', 'gtk-execute')) |
def parse_and_append( self, dir, filename): parser = RawConfigParser() parser.read( [ dir + filename ]) if not parser.has_section( sect): return | def parse_and_append( self, filename): try: parser = RawConfigParser() parser.read( [ filename ]) if not parser.has_section( sect): return | def parse_and_append( self, dir, filename): parser = RawConfigParser() parser.read( [ dir + filename ]) if not parser.has_section( sect): return try: app_name = parser.get( sect, 'Name') app_cmd = parser.get( sect, 'Exec') app_mime = parser.get( sect, 'MimeType') app_icon = parser.get( sect, 'Icon') if app_mime.find( ... |
try: | def parse_and_append( self, dir, filename): parser = RawConfigParser() parser.read( [ dir + filename ]) if not parser.has_section( sect): return try: app_name = parser.get( sect, 'Name') app_cmd = parser.get( sect, 'Exec') app_mime = parser.get( sect, 'MimeType') app_icon = parser.get( sect, 'Icon') if app_mime.find( ... | |
log( 'Player found: %s (%s in %s)', app_name, filename, dir) | log( 'Player found: %s (%s)', app_name, filename) | def parse_and_append( self, dir, filename): parser = RawConfigParser() parser.read( [ dir + filename ]) if not parser.has_section( sect): return try: app_name = parser.get( sect, 'Name') app_cmd = parser.get( sect, 'Exec') app_mime = parser.get( sect, 'MimeType') app_icon = parser.get( sect, 'Icon') if app_mime.find( ... |
self.items_model = self.channels[self.active_channel].getItemsModel() self.treeAvailable.set_model( self.items_model) except: dlg = gtk.MessageDialog( self.gPodder, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK) dlg.set_markup( "<big>No Channels found</big>\n\nClick on \"Channels\"->\"Add channel..\" to add a new ... | self.items_model = self.channels[self.active_channel].getItemsModel() self.treeAvailable.set_model( self.items_model) except: if self.items_model != None: self.items_model.clear() self.showMessage( "<b>No channels found</b>\n\nClick on <b><i>Channels</i></b> > <b><i>Add channel..</i></b> to add a new channel.") | def updateTreeView( self): try: self.items_model = self.channels[self.active_channel].getItemsModel() self.treeAvailable.set_model( self.items_model) except: dlg = gtk.MessageDialog( self.gPodder, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK) dlg.set_markup( "<big>No Channels found</big>\n\nClick on \"Channels\"-... |
url_old = self.channels[active].url title_old = self.channels[active].title desc_old = self.channels[active].description downloaddir_old = self.channels[active].save_dir | try: url_old = self.channels[active].url title_old = self.channels[active].title desc_old = self.channels[active].description downloaddir_old = self.channels[active].save_dir except: self.showMessage( "Cannot edit this channel.\n\nNo channel found.") return | def on_itemEditChannel_activate(self, widget, *args): if libgpodder.isDebugging(): print "on_itemEditChannel_activate called with self.%s" % widget.get_name() active = self.active_channel url_old = self.channels[active].url title_old = self.channels[active].title desc_old = self.channels[active].description downloaddir... |
selection_tuple = self.treeAvailable.get_selection().get_selected() selection_iter = selection_tuple[1] url = self.items_model.get_value( selection_iter, 0) | try: selection_tuple = self.treeAvailable.get_selection().get_selected() selection_iter = selection_tuple[1] url = self.items_model.get_value( selection_iter, 0) except: self.showMessage( "You have not selected an episode to download.\n\nPlease select one, and I'll download it for you.") return | def on_treeAvailable_row_activated(self, widget, *args): if libgpodder.isDebugging(): print "on_treeAvailable_row_activated called with self.%s" % widget.get_name() selection_tuple = self.treeAvailable.get_selection().get_selected() selection_iter = selection_tuple[1] url = self.items_model.get_value( selection_iter, 0... |
selection_iter = self.comboDownloaded.get_active_iter() selected_value = self.comboDownloaded.get_model().get_value( selection_iter, 0) if libgpodder.isDebugging(): print "comboDownloaded_changed with: " + selected_value new_model = self.ldb.getDownloadedEpisodesModelByFilename( selected_value) self.treeDownloaded.set_... | try: selection_iter = self.comboDownloaded.get_active_iter() selected_value = self.comboDownloaded.get_model().get_value( selection_iter, 0) if libgpodder.isDebugging(): print "comboDownloaded_changed with: " + selected_value new_model = self.ldb.getDownloadedEpisodesModelByFilename( selected_value) self.treeDownloaded... | def on_comboDownloaded_changed(self, widget, *args): if libgpodder.isDebugging(): print "on_comboDownloaded_changed called with self.%s" % widget.get_name() self.active_downloaded_channels = self.comboDownloaded.get_active() selection_iter = self.comboDownloaded.get_active_iter() selected_value = self.comboDownloaded.g... |
selection_iter = self.comboDownloaded.get_active_iter() channel_filename = self.comboDownloaded.get_model().get_value( selection_iter, 0) selection_tuple = self.treeDownloaded.get_selection().get_selected() selection_iter = selection_tuple[1] url = self.treeDownloaded.get_model().get_value( selection_iter, 0) filename... | try: selection_iter = self.comboDownloaded.get_active_iter() channel_filename = self.comboDownloaded.get_model().get_value( selection_iter, 0) selection_tuple = self.treeDownloaded.get_selection().get_selected() selection_iter = selection_tuple[1] url = self.treeDownloaded.get_model().get_value( selection_iter, 0) fil... | def on_treeDownloaded_row_activated(self, widget, *args): if libgpodder.isDebugging(): print "on_treeDownloaded_row_activated called with self.%s" % widget.get_name() # TODO: refactor with above "on_comboDownloaded_changed" into one method (next three lines) selection_iter = self.comboDownloaded.get_active_iter() chann... |
selection_iter = self.comboDownloaded.get_active_iter() channel_filename = self.comboDownloaded.get_model().get_value( selection_iter, 0) selection_tuple = self.treeDownloaded.get_selection().get_selected() selection_iter = selection_tuple[1] try: | try: selection_iter = self.comboDownloaded.get_active_iter() channel_filename = self.comboDownloaded.get_model().get_value( selection_iter, 0) selection_tuple = self.treeDownloaded.get_selection().get_selected() selection_iter = selection_tuple[1] | def on_btnDownloadedDelete_clicked(self, widget, *args): if libgpodder.isDebugging(): print "on_btnDownloadedDelete_clicked called with self.%s" % widget.get_name() # Note: same code as in on_treeDownloaded_row_activated() selection_iter = self.comboDownloaded.get_active_iter() channel_filename = self.comboDownloaded.... |
self.percentage = 'n/a' | self.percentage = '0' | def thread_function( self): command = "wget \"" + self.url + "\" -O \"" + self.tempname + "\"" print command process = popen2.Popen3( command, True) self.pid = process.pid stderr = process.childerr while process.poll() == -1 and self.is_cancelled == False: msg = stderr.readline( 80) if libgpodder.isDebugging(): print... |
id3v2_tags = id3.ID3v2( local_filename ) | id3v2_tags = ID3.ID3v2( local_filename ) | def set_cover_art(self, track, local_filename): if not ipod_supported(): return False if use_pyid3: try: cover_filename = local_filename + '.cover.jpg' id3v2_tags = id3.ID3v2( local_filename ) for frame in id3v2_tags.frames: if frame.id == 'APIC': cover_file = file(cover_filename, 'w') cover_file.write(frame.image) cov... |
print command | if libgpodder.isDebugging(): print command | def thread_function( self): command = "wget \"" + self.url + "\" -O \"" + self.tempname + "\"" print command process = popen2.Popen3( command, True) self.pid = process.pid stderr = process.childerr while process.poll() == -1 and self.is_cancelled == False: msg = stderr.readline( 80) if libgpodder.isDebugging(): print... |
diff = int((time() - timestamp)/seconds_in_a_day) | diff = int((time()+1)/seconds_in_a_day) - int(timestamp/seconds_in_a_day) | def cute_pubdate( self): seconds_in_a_day = 86400 try: timestamp = int(mktime_tz( parsedate_tz( self.pubDate))) except: return _("(unknown)") diff = int((time() - timestamp)/seconds_in_a_day) if diff == 0: return _("Today") if diff == 1: return _("Yesterday") if diff < 7: return str(datetime.fromtimestamp( timestamp).... |
last_episode = None | def newest_pubdate_downloaded( self): gl = libgpodder.gPodderLib() last_episode = None | |
if gl.history_is_downloaded( episode.url) and last_episode: return last_episode.pubDate last_episode = episode | if gl.history_is_downloaded( episode.url): return episode.pubDate | def newest_pubdate_downloaded( self): gl = libgpodder.gPodderLib() last_episode = None |
self.url = self.entryURL.get_text() | def on_gPodderChannel_destroy(self, widget, *args): if libgpodder.isDebugging(): print "on_gPodderChannel_destroy called with self.%s" % widget.get_name() self.result = False self.url = self.entryURL.get_text() | |
configlet_tree = ConfigletTree() | def __init__(self,name,**kw): Holder.__init__(self,**kw) self.name = name self.__dict__.setdefault("type","string") self.__dict__.setdefault("len",60) self.__dict__.setdefault("size",20) self.__dict__.setdefault("title",self.name) self.__dict__.setdefault("hint","") self.__dict__.setdefault("optional", False) self.__di... | |
global configlet_tree | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("_X.","Set(CALLERID(name)=%s)" % self.clid) if self.contextin == 'phone' and self.phon... | |
c.append('callerid=%s' % self.calleridnum) | c.append('callerid=<%s>' % self.calleridnum) else: c.append('callerid=<%s>' % self.ext) | def createAsteriskConfig(self): needModule("chan_zap") |
if self.enablecallgroup: c.append('callgroup=%s' % self.callgroup) c.append('pickupgroup=%s' % self.callgroup) | def createAsteriskConfig(self): needModule("chan_zap") | |
s.appendExten("s","GotoIf(%s?%s,s,1)" % (t,self.ivrtime)) | s.appendExten("s","GotoIfTime(%s?%s,s,1)" % (t,self.ivrtime)) | def createAsteriskConfig(self): s = AstConf("extensions.conf") s.setSection(self.name) if self.phones: s.append("include=phones") s.appendExten("s","Wait(1)") s.appendExten("s","DigitTimeout,2.3") if self.ivrtime: if self.times: times=self.times.split(',') for t in times: s.appendExten("s","GotoIf(%s?%s,s,1)" % (t,self... |
VarType("transferdigittimeout", title=_("Number of seconds to wait between digits when transfering a call"), hint=_(Default is 3 seconds), type="int", len=6, optional=True, default=3), VarType("atxfernoanswertimeout", title=_("Number of seconds to wait between digits when transfering a call"), hint=_(Default is 3 secon... | VarType("transferdigittimeout", title=_("Number of seconds to wait between digits when transfering a call"), hint=_("Default is 3 seconds"), type="int", len=6, optional=True, default=3), VarType("atxfernoanswertimeout", title=_("Timeout for answer on attended transfer"), hint=_("Default is 15 seconds"), type="int", len... | def createVariables(self): self.variables = [ VarType("blindxfer", title=_("Blind Transfer Extension"), len=6, optional=True), VarType("atxfer", title=_("Attended Transfer Extension"), len=6, optional=True), VarType("transferdigittimeout", title=_("Number of seconds to wait between digits when transfering a call"), hin... |
c.appendExten("%s" % obj.pattern,"Macro(%s,%s${EXTEN:%s}.%s,%s)" % (obj.name,obj.addprefix,obj.rmprefix,secret,timeoutvalue)) | c.appendExten("%s" % obj.pattern,"Macro(%s,%s${EXTEN:%s},%s,%s)" % (obj.name,obj.addprefix,obj.rmprefix,secret,timeoutvalue)) | def createOutgoingContext(self): c = AstConf("extensions.conf") c.setSection("out-%s" % self.name) try: pbx = self.pbx except AttributeError: pbx = "phones" c.append("include=>%s" % pbx) c.appendExten("i","Playback(privacy-invalid)") try: timeoutvalue = not self.timeout and "0" or "1" except AttributeError: timeoutvalu... |
if self.anounce and not self.anouncefrequency: return ('anouncefrequency',_("You should select a frequency")) | if self.announce and not self.announcefrequency: return ('announcefrequency',_("You should select a frequency")) | def checkConfig(self): res = CfgPhone.checkConfig(self) if res: return res if self.anounce and not self.anouncefrequency: return ('anouncefrequency',_("You should select a frequency")) |
if self.anounce: c.append("announce-frequency=%s" % self.anouncefrequency) c.append("announce-holdtime=%s" % self.anounceholdtime) | if self.announce: c.append("announce-frequency=%s" % self.announcefrequency) c.append("announce-holdtime=%s" % self.announceholdtime) | def createAsteriskConfig(self): needModule("res_monitor") needModule("app_queue") |
if _v == None: | if _v == None or _v == "": | def createPythonConfig(self): """Returns an array of strings that resends this class in Python syntax. Can be stored in cfg.py (or whereever) and re-read with execfile().""" |
cont = ("False","True")[_v] | if _v: cont = "True" else: continue | def createPythonConfig(self): """Returns an array of strings that resends this class in Python syntax. Can be stored in cfg.py (or whereever) and re-read with execfile().""" |
s.appendExten("s","Set(TIMEOUT(digit)=%d" % self.digittimeout) | s.appendExten("s","Set(TIMEOUT(digit)=%d)" % self.digittimeout) | def createAsteriskConfig(self): s = AstConf("extensions.conf") s.setSection(self.name) if self.pbx: pbx = self.pbx else: pbx = "phones" s.append("include=%s" % pbx) s.appendExten("s","Wait(%d)" % self.waittime) s.appendExten("s","Set(TIMEOUT(digit)=%d" % self.digittimeout) if self.moh: s.appendExten("s","Setmusiconhold... |
VarType("busydetect", title=_("Try to detect busy signal to detect if remove site hung up"), type="bool"), | VarType("busydetect", title=_("Try to detect busy signal to detect if remote site hung up"), type="bool"), | def createVariables(self): self.variables = [ VarType("busydetect", title=_("Try to detect busy signal to detect if remove site hung up"), type="bool"), VarType("busycount", title=_("Wait how many busy signals before hanging up"), type="int", default=5), #VarType("callprogress", title=_("?"), type="bool"), ] |
self.dial = "IAX2/%s/${ARG1}" % self.host | self.dial = "IAX2/%s/${ARG1}" % self.name | def createAsteriskConfig(self): |
c.append("exten=s,2,Goto(${ARG2},${temp})") | c.append("exten=s,2,Goto(${ARG2},${temp},1)") | def initializeAsteriskConfig(): """This puts some hard coded default values into some asterisk config files: * adsi.conf * extconfig.conf * extensions.conf * sip.conf * iax.conf * zapata.conf * macros.inc """ # Start with empty config files configlets.asterisk_configfiles = [] c = AstConf("adsi.conf") c.setSection... |
c.append("exten=s,211,Goto(${ARG2},${temp})") | c.append("exten=s,211,Goto(${ARG2},${temp},1)") | def initializeAsteriskConfig(): """This puts some hard coded default values into some asterisk config files: * adsi.conf * extconfig.conf * extensions.conf * sip.conf * iax.conf * zapata.conf * macros.inc """ # Start with empty config files configlets.asterisk_configfiles = [] c = AstConf("adsi.conf") c.setSection... |
ret = extensions.appendExten(exten, "Macro(dial-std-exten,%s/%s,%s,%d)" % ( | ret = extensions.appendExten(exten, "Macro(dial-std-exten,%s/%s,out-%s,%d)" % ( | def createDialEntry(self, extensions, exten): ret = extensions.appendExten(exten, "Macro(dial-std-exten,%s/%s,%s,%d)" % ( self.technology, self.name, "phones", int(self.usevm)) ) |
"phones", | self.name, | def createDialEntry(self, extensions, exten): ret = extensions.appendExten(exten, "Macro(dial-std-exten,%s/%s,%s,%d)" % ( self.technology, self.name, "phones", int(self.usevm)) ) |
return false | return False | def hasConfiglet(self, _class): for obj in self: if obj.__class__.__name__ == _class: return True return false |
VarType("panelLab", title=_("Operator Panel"), type="label", hide=True), VarType("panel", title=_("Show this trunk in the panel"), type="bool", hide=True, optional=True), | VarType("panelLab", title=_("Operator Panel"), type="label", hide=True), VarType("panel", title=_("Show this trunk in the panel"), type="bool", hide=True), | def createVariables(self): self.variables = [ VarType("name", title=_("Name"), len=15, default="siptrunk"), VarType("id", title=_("SIP username"), len=15), VarType("pw", title=_("SIP password"), len=15), VarType("host", title=_("SIP host"), len=25), VarType("register", title=_("Registe... |
VarType("Inbound", title=_("Calls from SIP trunk"), type="label"), VarType("contextin", title=_("Go to"), type="radio", default='phone', options=[('phone',_("Phone")),('ivr',_("IVR"))]), VarType("phone", title=_("Extension to ring"), type="choice", optional=False, options=getChoice("CfgPhone")), VarType("i... | VarType("Inbound", title=_("Calls from SIP trunk"), type="label"), VarType("contextin", title=_("Go to"), type="radio", default='phone', options=[('phone',_("Phone")),('ivr',_("IVR"))]), VarType("phone", title=_("Extension to ring"), type="choice", optional=False, options=getChoice("CfgPhone")), VarType("ivr", title... | def createVariables(self): self.variables = [ VarType("name", title=_("Name"), len=15, default="siptrunk"), VarType("id", title=_("SIP username"), len=15), VarType("pw", title=_("SIP password"), len=15), VarType("host", title=_("SIP host"), len=25), VarType("register", title=_("Registe... |
c.append("auth=md5") | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") | |
c.appendExten("s","Set(CALLERID(name)=%s)" % self.clid) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("s","Set(CALLERID(name)=%s)" % ... | |
c.appendExten("s", "Goto(%s,%s,1)" % (pbx,self.phone)) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("s","Set(CALLERID(name)=%s)" % ... | |
c.appendExten("s", "Goto(%s,s,1)" % self.ivr) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("s","Set(CALLERID(name)=%s)" % ... | |
c.appendExten("s", "Goto(%s,s,1)" % self.pbx) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("s","Set(CALLERID(name)=%s)" % ... | |
c.appendExten("s",'SetVar(options=TtL(%d:10000))' % self.maxtime) | c.appendExten("s",'SetVar(options=TtL(%d000:10000))' % self.maxtime) | def createAsteriskConfig(self): c = AstConf("macros.inc") c.setSection("macro-%s" % self.name) c.append("; params: exten,secret,timeout") needModule("app_authenticate") if self.qlookup: c.appendExten("s","DBget(dest=QUICKDIALLIST/GLOBAL/${ARG1})",e="Goto(3)") c.appendExten("s",'SetVar(ARG1=${dest})') c.appendExten("s",... |
def getChoice(clazz, key='name',val='name'): | def getChoice(clazz, key='name',val='name',sort=True): | def getChoice(clazz, key='name',val='name'): """This is used to generate a list of tuples which we later use in the select widgets of type "choice" or "mchoice". 'clazz' is the classname the configlet must have.""" # TODO: this sould be changed for something like CheckConfig if not __loaded: loadPythonConfig() a = []... |
c.appendExten("_X.", "Goto(%s,%s,1)" % (pbx,self.phone)) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("_X.","Set(CALLERID(name)=%s)" % self.clid) global configlet_tree if self.contextin ==... | |
c.appendExten("s", "Goto(%s,%s,1)" % (pbx,self.phone)) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("_X.","Set(CALLERID(name)=%s)" % self.clid) global configlet_tree if self.contextin ==... | |
VarType("dis_transfer", title=_("Disallow calling user transfer?"), type="bool"), | def createVariables(self): self.variables = [ VarType("name", title=_("Name"), len=15), VarType("pattern", title=_("Pattern"), len=55), VarType("rmprefix", title=_("Remove Prefix of length"), len=10, default="0"), VarType("addprefix", title=_("Add Prefix"), len=10, optional=True, default=""), VarType("maxtime", title... | |
c.append("anounce-frequency=%s" % self.anouncefrequency) c.append("anounce-holdtime=%s" % self.anounceholdtime) | c.append("announce-frequency=%s" % self.anouncefrequency) c.append("announce-holdtime=%s" % self.anounceholdtime) | def createAsteriskConfig(self): needModule("res_monitor") needModule("app_queue") |
self.dial = "Zap/%s/${ARG1}" % (self.channels) | self.dial = "Zap/%s/${ARG1}" % (self.channel) | def createAsteriskConfig(self): needModule("chan_zap") |
obj_name = dep.name[8:] | if dep.name.startswith('dialout_'): obj_name = dep.name[8:] else: obj_name = self.__dict__[dep.name] | def createDependencies(self): for dep in self.dependencies: if self.__dict__.has_key(dep.name): obj_name = dep.name[8:] # get the name after "dialout_" import configlets obj = configlets.configlet_tree.getConfigletByName(obj_name) if obj is None: return dependent_obj = DependentObject(self, dep) obj.dependent_objs.appe... |
CfgLine.fixup() | CfgLine.fixup(self) | def fixup(self): CfgLine.fixup() useContext("in-pstn") for obj in configlets.config_entries: if isinstance(obj, configlets.CfgPhone): print obj.__class__.__name__ |
c.appendExten("%s%s" % (self.msn,p.ext), "Macro(exten-std,SIP/%s)" % p.name) | def createAsteriskConfiglet(self): needModule("chan_zap") | |
c.appendExten("_X.", "Goto(%s,${EXTEN},1)" % self.ivr) | c.appendExten("_X.", "Goto(%s,${EXTEN},1)" % self.pbx) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("func_callerid") c.appendExten("s","Set(CALLERID(name)=%s)" % self.clid) global configlet_tree if self.contextin == 'ph... |
useContext("in-siptrunk") | useContext(self.contextin) | def fixup(self): CfgTrunk.fixup(self) useContext(self.context) useContext("in-siptrunk") |
ext = "_%s." % self.ext | ext = "_%sX." % self.ext | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") |
c.appendExten(ext, "Dial(SIP/%s:%s@%s/${EXTEN:%d},60,r)" % (self.id, self.pw, self.host, len(self.ext))) | c.appendExten(ext, "Dial(SIP/${EXTEN:%d}@%s,60,r)" % (len(self.ext), self.host)) | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") |
if self.extin and self.contextin: | if self.phone and self.contextin: | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") |
c.appendExten("s", "Goto(default,%s,1)" % self.extin) | c.appendExten("s", "Goto(default,%s,1)" % self.phone) | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") |
c.append("secret= %s" % self.pw) | c.append("secret=%s" % self.pw) c.append("canreinvite=no") | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") |
c.append("canreinvite=no") | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") | |
c.appendExten(ext, "Congestion") | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") | |
c.setSection(self.name) c.append("type=friend") c.append("context=in-siptrunk") | c.setSection("out-%s" % self.name) c.append("type=user") c.append("username=%s" % self.id) c.append("secret=%s" % self.pw) c.append("host=%s" % self.host) c.append("context=out-siptrunk") | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") |
c.append("host=%s" % self.host) c.append("secret=%s" % self.pw) | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_sip") | |
c.appendExten("_X.","SetCIDName(%s)" % self.clid) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("app_setcidname") c.appendExten("_X.","SetCIDName(%s)" % self.... | |
c.appendExten("_X.", "Goto(%s,%s,1)" % (pbx,self.phone)) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("app_setcidname") c.appendExten("_X.","SetCIDName(%s)" % self.... | |
c.appendExten("_X.", "Goto(%s,s,1)" % self.ivr) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) c.appendExten("_X.","Set(CDR(intrunk)=%s)" % self.name) c.appendExten("s","Set(CDR(intrunk)=%s)" % self.name) if self.clid: needModule("app_setcidname") c.appendExten("_X.","SetCIDName(%s)" % self.... | |
if self.moh: extensions.appendExten(self.ext, "SetMusicOnHold(%s)" % self.moh) | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") | |
else: | elif self.moh: extensions.appendExten(self.ext, "SetMusicOnHold(%s)" % self.moh) | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") |
if self.moh: extensions.appendExten(self.name, "SetMusicOnHold(%s)" % self.moh) | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") | |
extensions.appendExten(self.name, "Queue(%s|Tth)" % self.name) | if self.ring: extensions.appendExten(self.name, "Queue(%s|Tthr)" % self.name) elif self.moh: extensions.appendExten(self.name, "SetMusicOnHold(%s)" % self.moh) extensions.appendExten(self.name, "Queue(%s|Tth)" % self.name) | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") |
createAsteriskConfig() | writeAsteriskConfig() | def reloadAsterisk(): """This reloads the Asterisk PBX.""" createPythonConfig() createAsteriskConfig() import manager s = manager.reloadAsterisk() if panelutils.isConfigured(): s += panelutils.restartPanelDaemon() return "<br/>".join(s) |
title=_("Disable IAX transfer"), | title=_("Skip asterisk media path?"), | def createVariables(self): self.variables = [ VarType("pbx", title=_("Virtual PBX"), type="choice", options=getChoice("CfgOptPBX")), |
iax.append("notransfer=%s" % self.notransfer) | if not self.notransfer: iax.append("notransfer=yes") | def createAsteriskConfig(self): needModule("res_crypto") needModule("chan_iax2") iax = AstConf("iax.conf") iax.setSection(self.name) iax.append("type=friend") iax.appendValue(self, "secret") iax.append("host=dynamic") iax.appendValue(self, "host", "defaultip") iax.append("context=out-%s" % self.name) if self.calleridn... |
extensions.appendExten(self.ext, "Answer") | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.