rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
id = dump_contents_entry(subentry, id, parent_id) | sublast = last and subentry is entry[-1] print " (@book_id, %d, %d, %s, %s)%s" % (parent_id, subentry.number, quote(subentry.name.encode('utf-8')), quote(subentry.link.encode('utf-8')), (sublast and not len(subentry)) and ";" or ",") id = dump_contents_entry(subentry, id, sublast) | def dump_contents_entry(entry, id, parent_id): print " (@book_id, %d, %d, %s, %s)," % (parent_id, entry.number, quote(entry.name.encode('utf-8')), quote(entry.link.encode('utf-8'))) parent_id = id id = parent_id + 1 for subentry in entry: id = dump_contents_entry(subentry, id, parent_id) return id |
print "INSERT INTO `pages` (book_id, path, data) VALUES" for path in archive.list(): data = archive.open(path).read() print " (@book_id, %s, %s)," % (quote(path.encode('utf-8')), quote(data)) print ";" | print "INSERT INTO `pages` (book_id, path, content) VALUES" paths = archive.list() for path in paths: last = path is paths[-1] content = archive.open(path).read() print " (@book_id, %s, %s)%s" % (quote(path.encode('utf-8')), quote(content), last and ';' or ',') | def dump_archive(archive): print "INSERT INTO `pages` (book_id, path, data) VALUES" for path in archive.list(): data = archive.open(path).read() print " (@book_id, %s, %s)," % (quote(path.encode('utf-8')), quote(data)) print ";" |
import sys from DevHelp import factory | from HTB import factory | def main(): import sys from DevHelp import factory for arg in sys.argv[1:]: try: book = factory(arg) except: raise dump(book) |
os.path.join(os.getenv('HOME'), '.devhelp2', 'books'), | os.path.join(os.getenv('HOME', ''), '.devhelp2', 'books'), | def __init__(self, search_path = None): Book.CachingFactory.__init__(self) self._search_path = [ os.path.join(os.getenv('HOME'), '.devhelp2', 'books'), '/usr/share/gtk-doc/html'] if search_path is not None: self._search_path.extend(search_path) self._path_hash = {} |
for name in os.listdir(dir): spec = os.path.join(dir, name, name + '.devhelp') if os.path.isfile(spec): self._path_hash[name] = spec enum.append(name) | if os.path.isdir(dir): for name in os.listdir(dir): spec = os.path.join(dir, name, name + '.devhelp') if os.path.isfile(spec): self._path_hash[name] = spec enum.append(name) | def enumerate_uncached(self): enum = Book.List() self._path_hash = {} for dir in self._search_path: for name in os.listdir(dir): spec = os.path.join(dir, name, name + '.devhelp') if os.path.isfile(spec): self._path_hash[name] = spec enum.append(name) |
item._parentref = weakred.ref(self) | item._parentref = weakref.ref(self) | def insert(self, index, item): item._parentref = weakred.ref(self) item.number = index + 1 self._children.insert(index, item) self._renumber() |
return self,_children[0] | return self._children[0] | def _get_children(self): """Get the first child.""" |
return urlparse.urljoin(base, link) | return urlparse.urljoin(self.base, link) | def translate_link(self, link): if self.base is None: return link else: return urlparse.urljoin(base, link) |
self.book.default = self.translate(link) | self.book.default = self.translate_link(link) | def start_book(self, name, title, link, base = None, **dummy): assert len(self.contents_stack) == 1 |
parser.parser(open(spec)) | parser.parse(open(spec)) | def __init__(self, spec): DevHelpBook.__init__(self) |
if self.entry: | if self.entry is not None: | def handle_starttag(self, tag, attrs): attrs = dict(attrs) if tag == 'object': if attrs['type'] == 'text/sitemap': self.entry = Book.IndexEntry(None) elif tag == 'param': if self.entry: if attrs['name'] == 'Name': if self.entry.name is None: self.entry.name = attrs['value'].strip() elif attrs['name'] == 'Local': self.e... |
if self.entry: | if self.entry is not None: | def handle_endtag(self, tag): if tag == 'object': if self.entry: self.book.index.append(self.entry) self.entry = None |
def test_extract(): for arg in sys.argv[1:]: title, body = extract_html(open(arg, "rt").read()) print `title` print print `body` print print | def extract(path, content): """Extract the title and body of a document in plaintext.""" type = guess_type(path) if type == 'text/html': return extract_html(content) elif type == 'text/plain': return None, content else: return None, None | |
path, anchor = split_link(subentry.link) | path, anchor = subentry.link is None and ('', '') or split_link(subentry.link) | def dump_contents_entries(entry, parent_number, cont = 0): number = parent_number + 1 for subentry in entry: name = subentry.name path, anchor = split_link(subentry.link) sys.stdout.write(cont and ',\n ' or '\n ') sys.stdout.write('(' + ', '.join(quote(literal('@book_id'), number, parent_number, name, path, anchor)) +... |
def OnLinkClicked(self, link): self.m_Frame.NotifyPageChanged() | def OnLinkClicked(self, link): self.m_Frame.NotifyPageChanged() | |
import Generic book_factory = Generic.BookFactory() | def AddBooks(self): import Generic book_factory = Generic.BookFactory() root = self.m_ContentsBox.AddRoot("Books") for name in book_factory.enumerate(): book = book_factory.book(name) self.AddBook(root, book) | |
h = book.page(link).read() self.m_HtmlWin.SetPage(h) | if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location) | def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) h = book.page(link).read() self.m_HtmlWin.SetPage(h) |
if __name__ == "__main__": | def main(): | def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR... |
return path[1:] | return path[8:] | def filter(self, path): if path[:8] == '/sample/': return path[1:] else: return None |
self.entry.link = value | self.entry.links.append(value) | def handle_param(self, name, value): if name == 'Name': self.entry.name = value elif name == 'Local': self.entry.link = value |
if self.node: | if self.node is not None: | def handle_starttag(self, tag, attrs): attrs = dict(attrs) if tag == 'ul': if len(self.contents_stack) == 0: node = self.book.contents else: assert self.node is not None node = self.node self.contents_stack.append(node) self.node = None elif tag == 'object': if attrs['type'] == 'text/sitemap': self.node = Book.Conten... |
if self.node: | if self.node is not None: | def handle_endtag(self, tag): if tag == 'ul': self.contents_stack.pop() elif tag == 'object': if self.node: self.contents_stack[-1].append(self.node) |
_html_title_re = re.compile(r'<title(?:\s.*?)?>(.*?)</title>', re.IGNORECASE | re.DOTALL) _html_body_re = re.compile(r'<body(?:\s.*?)?>(.*?)</body>', re.IGNORECASE | re.DOTALL) | _html_title_re = re.compile(r'<title(?:\s.*?)?>(.*?)</title\s*>', re.IGNORECASE | re.DOTALL) _html_body_re = re.compile(r'<body(?:\s.*?)?>(.*?)</body\s*>', re.IGNORECASE | re.DOTALL) | def html_entity_decode(s, encoding = 'iso-8859-1'): """Decode HTML entities in a string into Unicode.""" r = [] p = 0 mo = _html_entity_re.search(s, p) while mo: r.append(s[p:mo.start()].decode(encoding)) i = mo.lastindex e = mo.group(i) try: if i == 1: c = htmlentitydefs.name2codepoint[e] elif i == 2: c = int(e) el... |
toolBar = self.CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_DOCKABLE | wxTB_FLAT) toolBar.SetMargins((2, 2)) | toolBar = self.CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
self.m_TitleFormat = '' | self.m_HtmlWin = m_HtmlWin self.m_TitleFormat = '%s' | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
notebook_page = 0 | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) | |
dummy = wxPanel(m_NavigNotebook, wxID_HTML_INDEXPAGE) | panel = wxPanel(m_NavigNotebook, wxID_HTML_INDEXPAGE) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
topsizer.Add(0, 10) dummy.SetAutoLayout(TRUE) dummy.SetSizer(topsizer) if style & wxHF_BOOKMARKS and 0: m_Bookmarks = wxComboBox(dummy, wxID_HTML_BOOKMARKSLIST, '', wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY | wxCB_SORT) m_Bookmarks.Append("(bookmarks)") for i in range(m_BookmarksNames.GetCount()): m_Bo... | panel.SetAutoLayout(TRUE) panel.SetSizer(topsizer) m_ContentsBox = wxTreeCtrl(panel, wxID_HTML_TREECTRL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxTR_LINES_AT_ROOT) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
topsizer.Add(m_ContentsBox, 1, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 2) m_NavigNotebook.AddPage(dummy, "Contents") m_ContentsPage = notebook_page notebook_page += 1 | topsizer.Add(m_ContentsBox, 1, wxEXPAND | wxALL) m_NavigNotebook.AddPage(panel, "Contents") | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
dummy = wxPanel(m_NavigNotebook, wxID_HTML_INDEXPAGE); | panel = wxPanel(m_NavigNotebook, wxID_HTML_INDEXPAGE); | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
dummy.SetAutoLayout(TRUE) dummy.SetSizer(topsizer) m_IndexText = wxTextCtrl(dummy, wxID_HTML_INDEXTEXT, '', wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER) m_IndexButton = wxButton(dummy, wxID_HTML_INDEXBUTTON, "Find") m_IndexButtonAll = wxButton(dummy, wxID_HTML_INDEXBUTTONALL, "Show all") m_IndexCountInfo = wx... | panel.SetAutoLayout(TRUE) panel.SetSizer(topsizer) m_IndexText = wxTextCtrl(panel, wxID_HTML_INDEXTEXT, '', wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER) m_IndexList = wxListBox(panel, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, style=wxLB_SINGLE) topsizer.Add(m_IndexText, 0, wxEXPAND | wxALL) tops... | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
dummy.SetAutoLayout(TRUE) dummy.SetSizer(sizer) m_SearchText = wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT, '', wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER) m_SearchChoice = wxChoice(dummy, wxID_HTML_SEARCHCHOICE, wxDefaultPosition, wxDefaultSize) m_SearchCaseSensitive = wxCheckBox(dummy, -1, "Case sensitive") m_S... | panel.SetAutoLayout(TRUE) panel.SetSizer(sizer) m_SearchText = wxTextCtrl(panel, wxID_HTML_SEARCHTEXT, '', wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER) m_SearchChoice = wxChoice(panel, wxID_HTML_SEARCHCHOICE, wxDefaultPosition, wxDefaultSize) m_SearchCaseSensitive = wxCheckBox(panel, -1, "Case sensitive") m_S... | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
sizer.Add(m_SearchText, 0, wxEXPAND | wxALL, 10) sizer.Add(m_SearchChoice, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10) sizer.Add(m_SearchCaseSensitive, 0, wxLEFT | wxRIGHT, 10) sizer.Add(m_SearchWholeWords, 0, wxLEFT | wxRIGHT, 10) sizer.Add(m_SearchButton, 0, wxALL | wxALIGN_RIGHT, 8) sizer.Add(m_SearchList, 1, wxA... | sizer.Add(m_SearchText, 0, wxEXPAND | wxALL) sizer.Add(m_SearchChoice, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM) sizer.Add(m_SearchCaseSensitive, 0, wxLEFT | wxRIGHT) sizer.Add(m_SearchWholeWords, 0, wxLEFT | wxRIGHT) sizer.Add(m_SearchList, 1, wxEXPAND | wxALL) m_NavigNotebook.AddPage(panel, "Search") if style & w... | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
woptionsBitmap = wxArtProvider_GetBitmap(wxART_HELP_SETTINGS, wxART_HELP_BROWSER) assert wpanelBitmap.Ok() and wbackBitmap.Ok() and wforwardBitmap.Ok() and wupnodeBitmap.Ok() and wupBitmap.Ok() and wdownBitmap.Ok() and wopenBitmap.Ok() and wprintBitmap.Ok() and woptionsBitmap.Ok() | assert wpanelBitmap.Ok() and wbackBitmap.Ok() and wforwardBitmap.Ok() and wupnodeBitmap.Ok() and wupBitmap.Ok() and wdownBitmap.Ok() and wopenBitmap.Ok() and wprintBitmap.Ok() | def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w... |
if style & wxHF_PRINT or style & wxHF_OPEN_FILES: toolBar.AddSeparator() if style & wxHF_OPEN_FILES: toolBar.AddSimpleTool(wxID_HTML_OPENFILE, wopenBitmap, "Open HTML document") | def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w... | |
toolBar.AddSeparator() toolBar.AddSimpleTool(wxID_HTML_OPTIONS, woptionsBitmap, "Display options dialog") | def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TRUE) self.m_Splitter.Spl... | def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w... |
ID_ABOUT=101 ID_OPEN=102 ID_BUTTON1=110 ID_EXIT=200 class MainWindow(wxFrame): def __init__(self,parent,id,title): self.dirname='' wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE| wxNO_FULL_REPAINT_ON_RESIZE) self.control = wxTextCtrl(self, 1, style=wxTE_MULTILINE) self.CreateStatusBar() filemenu=... | if __name__ == "__main__": app = wxPySimpleApp() frame = MyFrame(None, -1, "HTML Help Books") frame.Show(TRUE) app.MainLoop() | def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w... |
print "hi" | def _extract_callback(h, ui, base_path): if ui.path[:1] != '/': return chmlib.CHM_ENUMERATOR_CONTINUE path = os.path.join(base_path, ui.path[1:]) if ui.length != 0: print "--> %s" % ui.path try: fout = open(path, "wb") except IOError: return chmlib.CHM_ENUMERATOR_FAILURE offset = 0L remain = ui.length while remain: ... | |
print "%d: seek(%d, %d)" % (self.n, offset, whence) | if 0: print "%d: seek(%d, %d)" % (self.n, offset, whence) | def seek(self, offset, whence): if self.n == 0 and whence == 0: whence = 2 elif whence < 0: whence = 1 self.n += 1 |
class MyFileSystemHandler(wxFileSystemHandler): | class BookFileSystemHandler(wxFileSystemHandler): | def seek(self, offset, whence): if self.n == 0 and whence == 0: whence = 2 elif whence < 0: whence = 1 self.n += 1 |
return self.GetProtocol(location) == 'hh' | return self.GetProtocol(location) == 'book' | def CanOpen(self, location): return self.GetProtocol(location) == 'hh' |
print name, link | def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat... | |
f = book.page(link) stream = wxInputStream(file_wrapper(f)) print location, mimetype, anchor | stream = wxInputStream(file_wrapper(book.get(link))) | def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat... |
wxFileSystem_AddHandler(MyFileSystemHandler()) wxHF_TOOLBAR = 0x0001 wxHF_CONTENTS = 0x0002 wxHF_INDEX = 0x0004 wxHF_SEARCH = 0x0008 wxHF_BOOKMARKS = 0x0010 wxHF_PRINT = 0x0040 wxHF_FLAT_TOOLBAR = 0x0080 wxHF_MERGE_BOOKS = 0x0100 wxHF_ICONS_BOOK = 0x0200 wxHF_ICONS_BOOK_CHAPTER = 0x0400 wxHF_ICONS_FOLDER = 0x0000 wxH... | wxFileSystem_AddHandler(BookFileSystemHandler()) style_TOOLBAR = 0x0001 style_CONTENTS = 0x0002 style_INDEX = 0x0004 style_SEARCH = 0x0008 style_BOOKMARKS = 0x0010 style_OPEN_FILES = 0x0020 style_PRINT = 0x0040 style_FLAT_TOOLBAR = 0x0080 style_MERGE_BOOKS = 0x0100 style_ICONS_BOOK = 0x0200 style_ICONS_BOOK_CHA... | def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat... |
self.m_Frame = frame class MyFrame(wxFrame): def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) | self.frame = frame def OnLinkClicked(self, link): self.frame.NotifyPageChanged() class BookFrame(wxFrame): def __init__(self, parent, id, title, style = style_DEFAULT_STYLE): wxFrame.__init__(self, parent, -4, title, style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) | def __init__(self, frame, parent): wxHtmlWindow.__init__(self, parent) self.m_Frame = frame |
toolBar = self.CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT) self.AddToolBarButtons(toolBar, style) toolBar.Realize() EVT_TOOL_RANGE(self, wxID_HTML_PANEL, wxID_HTML_OPTIONS, self.OnToolbar) if style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH): | if style & style_TOOLBAR: self.toolBar = self.CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT) self.toolBar.AddSimpleTool( id_PANEL, wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER), "Show/hide navigation panel") self.toolBar.AddSeparator() self.toolBar.AddSimpleTool( id_BACK, wxArtProvider_G... | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
m_Splitter = wxSplitterWindow(self, -1) self.m_Splitter = m_Splitter m_HtmlWin = MyHtmlHelpHtmlWindow(self, m_Splitter) m_NavigPan = wxPanel(m_Splitter, -1) self.m_NavigPan = m_NavigPan m_NavigNotebook = wxNotebook(m_NavigPan, wxID_HTML_NOTEBOOK, wxDefaultPosition, wxDefaultSize) nbs = wxNotebookSizer(m_NavigNotebook) | self.splitter = wxSplitterWindow(self, -1) self.htmlWindow = MyHtmlWindow(self, self.splitter) self.navigationPanel = wxPanel(self.splitter, -1) self.navigationNotebook = wxNotebook(self.navigationPanel, id_NOTEBOOK, wxDefaultPosition, wxDefaultSize) navigationNotebookSizer = wxNotebookSizer(self.navigationNotebook) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
navigSizer = wxBoxSizer(wxVERTICAL) navigSizer.Add(nbs, 1, wxEXPAND) m_NavigPan.SetAutoLayout(TRUE) m_NavigPan.SetSizer(navigSizer) | navigationSizer = wxBoxSizer(wxVERTICAL) navigationSizer.Add(navigationNotebookSizer, 1, wxEXPAND) self.navigationPanel.SetAutoLayout(TRUE) self.navigationPanel.SetSizer(navigationSizer) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
m_HtmlWin = wxHtmlWindow(self) self.m_HtmlWin = m_HtmlWin self.m_TitleFormat = '%s' m_HtmlWin.SetRelatedFrame(self, self.m_TitleFormat) m_HtmlWin.SetRelatedStatusBar(0) if style & wxHF_CONTENTS: panel = wxPanel(m_NavigNotebook, wxID_HTML_INDEXPAGE) topsizer = wxBoxSizer(wxVERTICAL) | self.htmlWindow = wxHtmlWindow(self) self.titleFormat = '%s' self.htmlWindow.SetRelatedFrame(self, self.titleFormat) self.htmlWindow.SetRelatedStatusBar(0) if style & style_CONTENTS: contentsPage = wxPanel(self.navigationNotebook, id_INDEXPAGE) contentsSizer = wxBoxSizer(wxVERTICAL) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
panel.SetAutoLayout(TRUE) panel.SetSizer(topsizer) m_ContentsBox = wxTreeCtrl(panel, wxID_HTML_TREECTRL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxTR_LINES_AT_ROOT) self.m_ContentsBox = m_ContentsBox EVT_TREE_SEL_CHANGED(self, wxID_HTML_TREECTRL, self.OnContentsSel) | contentsPage.SetAutoLayout(TRUE) contentsPage.SetSizer(contentsSizer) self.contentsTree = wxTreeCtrl( contentsPage, id_TREECTRL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxTR_LINES_AT_ROOT) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
topsizer.Add(m_ContentsBox, 1, wxEXPAND | wxALL) m_NavigNotebook.AddPage(panel, "Contents") if style & wxHF_INDEX: panel = wxPanel(m_NavigNotebook, wxID_HTML_INDEXPAGE); topsizer = wxBoxSizer(wxVERTICAL) panel.SetAutoLayout(TRUE) panel.SetSizer(topsizer) m_IndexText = wxTextCtrl(panel, wxID_HTML_INDEXTEXT, '', wxD... | EVT_TREE_SEL_CHANGED(self, id_TREECTRL, self.OnContentsSel) contentsSizer.Add(self.contentsTree, 1, wxEXPAND | wxALL) self.navigationNotebook.AddPage(contentsPage, "Contents") if style & style_INDEX: indexPage = wxPanel(self.navigationNotebook, id_INDEXPAGE); indexSizer = wxBoxSizer(wxVERTICAL) indexPage.SetAutoLa... | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
sizer.Add(m_SearchText, 0, wxEXPAND | wxALL) sizer.Add(m_SearchChoice, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM) sizer.Add(m_SearchCaseSensitive, 0, wxLEFT | wxRIGHT) sizer.Add(m_SearchWholeWords, 0, wxLEFT | wxRIGHT) sizer.Add(m_SearchList, 1, wxEXPAND | wxALL) m_NavigNotebook.AddPage(panel, "Search") if style & w... | searchSizer.Add(self.searchText, 0, wxEXPAND | wxALL) searchSizer.Add(self.searchChoice, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM) searchSizer.Add(self.searchCaseSensitive, 0, wxLEFT | wxRIGHT) searchSizer.Add(self.searchWholeWords, 0, wxLEFT | wxRIGHT) searchSizer.Add(self.searchList, 1, wxEXPAND | wxALL) self.navig... | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
if navigSizer: navigSizer.SetSizeHints(m_NavigPan) m_NavigPan.Layout() class Cfg: pass m_Cfg = Cfg() m_Cfg.navig_on = 1 m_Cfg.sashpos = 250 | if navigationSizer: navigationSizer.SetSizeHints(self.navigationPanel) self.navigationPanel.Layout() self.navigation = 1 self.sashpos = 250 | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
if m_NavigPan and m_Splitter: m_Splitter.SetMinimumPaneSize(20) if m_Cfg.navig_on: m_Splitter.SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos) if m_Cfg.navig_on: m_NavigPan.Show(TRUE) m_Splitter.SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos) | if self.navigationPanel and self.splitter: self.splitter.SetMinimumPaneSize(20) if self.navigation: self.splitter.SplitVertically(self.navigationPanel, self.htmlWindow, self.sashpos) if self.navigation: self.navigationPanel.Show(TRUE) self.splitter.SplitVertically(self.navigationPanel, self.htmlWindow, self.sashpos) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
m_NavigPan.Show(FALSE) m_Splitter.Initialize(m_HtmlWin) | self.navigationPanel.Show(FALSE) self.splitter.Initialize(htmlWindow) | def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) |
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w... | def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w... | |
root = self.m_ContentsBox.AddRoot("Books") | root = self.contentsTree.AddRoot("Books") | def AddBooks(self): root = self.m_ContentsBox.AddRoot("Books") for name in book_factory.enumerate(): book = book_factory.book(name) book.name = name self.AddBook(root, book) |
child = self.m_ContentsBox.AppendItem(node, book.title()) self.m_ContentsBox.SetPyData(child, (book, book.link())) contents = book.contents() self.AddContents(child, book, contents) def AddContents(self, node, book, contents): for entry in contents: | child = self.contentsTree.AppendItem(node, book.title) self.contentsTree.SetPyData(child, (book, book.default)) self.AddContents(child, book, book.contents) def AddContents(self, tree_node, book, toc_node): for toc_child in toc_node.childs: | def AddBook(self, node, book): child = self.m_ContentsBox.AppendItem(node, book.title()) self.m_ContentsBox.SetPyData(child, (book, book.link())) contents = book.contents() self.AddContents(child, book, contents) |
child = self.m_ContentsBox.AppendItem(node, entry.title()) | name = toc_child.name | def AddContents(self, node, book, contents): for entry in contents: if wxUSE_UNICODE: child = self.m_ContentsBox.AppendItem(node, entry.title()) else: child = self.m_ContentsBox.AppendItem(node, entry.title().encode('iso-8859-1', 'replace')) self.m_ContentsBox.SetPyData(child, (book, entry.link())) self.AddContents(chi... |
child = self.m_ContentsBox.AppendItem(node, entry.title().encode('iso-8859-1', 'replace')) self.m_ContentsBox.SetPyData(child, (book, entry.link())) self.AddContents(child, book, entry.childs()) | name = toc_child.name.encode('iso-8859-1', 'replace') tree_child = self.contentsTree.AppendItem(tree_node, name) self.contentsTree.SetPyData(tree_child, (book, toc_child.link)) self.AddContents(tree_child, book, toc_child) def AddIndex(self, book, index): for entry in index: if wxUSE_UNICODE: term = entry.term else: t... | def AddContents(self, node, book, contents): for entry in contents: if wxUSE_UNICODE: child = self.m_ContentsBox.AppendItem(node, entry.title()) else: child = self.m_ContentsBox.AppendItem(node, entry.title().encode('iso-8859-1', 'replace')) self.m_ContentsBox.SetPyData(child, (book, entry.link())) self.AddContents(chi... |
return 'hh:/%s/%s' % (book.name, link) | return 'book:/%s/%s' % (book.name, link) | def Location(self, book, link): return 'hh:/%s/%s' % (book.name, link) |
(book, link) = self.m_ContentsBox.GetPyData(item) | (book, link) = self.contentsTree.GetPyData(item) | def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location) |
html = book.page(link).read() self.m_HtmlWin.SetPage(html) | html = book.get(link).read() self.htmlWindow.SetPage(html) | def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location) |
print location self.m_HtmlWin.LoadPage(location) | self.htmlWindow.LoadPage(location) | def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location) |
if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): | if event.GetId() == id_PANEL: if not (self.splitter and self.navigationPanel): | def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR... |
if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); | if self.splitter.IsSplit(): self.sashpos = self.splitter.GetSashPosition() self.splitter.Unsplit(self.navigationPanel); self.navigation = 1 | def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR... |
self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TRUE) self.m_Splitter.SplitVertically(self.m_NavigPan, self.m_HtmlWin, self.sashpos) | self.navigationPanel.Show(TRUE) self.htmlWindow.Show(TRUE) self.splitter.SplitVertically(self.navigationPanel, self.htmlWindow, self.sashpos) self.navigation = 1 def NotifyPageChanged(self): pass | def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR... |
frame = MyFrame(None, -1, "HTML Help Books") | frame = BookFrame(None, -1, "HTML Help Books") | def main(): app = wxPySimpleApp() frame = MyFrame(None, -1, "HTML Help Books") frame.Show(TRUE) app.MainLoop() |
parser = HHCParser(self) | parser = HHCParser(self.book) | def handle_entry(self, code, data): if code == 0: parser = HHCParser(self) parser.parse(self.book.archive[data]) elif code == 1: parser = HHKParser(self) parser.parse(self.book.archive[data]) elif code == 2: self.book.contents.link = data elif code == 3: self.book.contents.name = data |
parser = HHKParser(self) | parser = HHKParser(self.book) | def handle_entry(self, code, data): if code == 0: parser = HHCParser(self) parser.parse(self.book.archive[data]) elif code == 1: parser = HHKParser(self) parser.parse(self.book.archive[data]) elif code == 2: self.book.contents.link = data elif code == 3: self.book.contents.name = data |
logger.info(value) logger.info(self.format) | def convertFromCode(self, value, item=None): if value=='now': return DateTime.now() elif not value: return else: logger.info(value) logger.info(self.format) # DateTime.strptime is not available on Windows return DateTime.DateTime(*time.strptime(value, self.format)[:6]) | |
full_name = self._child_name(name, subname) | full_name = self._child_name(formname, subname) | def show(self, item, name, template_type, template_getter, global_namespace={}): value = getattr(item, name) subfields = [] for subname, field_type in self.fields: full_name = self._child_name(name, subname) proxied_item = self._Proxy(item, {full_name: value[subname]}) subfields.append(field_type.show(proxied_item, ful... |
self.__config = config | self._config = config | def __init__(self, config): self.__config = config |
return repr(self.__config) | return repr(self._config) | def __repr__(self): return repr(self.__config) |
return iter(self.__config) | return iter(self._config) | def __iter__(self): return iter(self.__config) |
return self.__config_dict[name] | return self._config_dict[name] def iteritems(self): return iter(self._config) | def __getitem__(self, name): return self.__config_dict[name] |
return self.__config_dict.iterkeys() def iteritems(self): return self.__config_dict.iteritems() def __config_dict(self): return dict(self.__config) __config_dict = qUtils.CachedAttribute(__config_dict) | for fn, ft in self: yield fn def items(self): return self._config[:] def keys(self): return [fn for fn, ft in self] def _config_dict(self): return dict(self._config) _config_dict = qUtils.CachedAttribute(_config_dict) | def iterkeys(self): return self.__config_dict.iterkeys() |
[(fn, ft) for fn, ft in self.__config if hasattr(ft, 'store')]) | [(fn, ft) for fn, ft in self._config if hasattr(ft, 'store')]) | def external(self): return FieldDescriptions( [(fn, ft) for fn, ft in self.__config if hasattr(ft, 'store')]) |
[(fn, ft) for fn, ft in self.__config if not hasattr(ft, 'store')]) | [(fn, ft) for fn, ft in self._config if not hasattr(ft, 'store')]) | def main(self): return FieldDescriptions( [(fn, ft) for fn, ft in self.__config if not hasattr(ft, 'store')]) |
query = Query("%s=" % name, Param(value)) | query = Query("%s=" % name, Param(self.convertToDB(value, item))) | def convertFromForm(self, form, name, item=None): value = STRING.convertFromForm(self, form, name, item) |
dbFalse - database value of False (default 0)""" | dbFalse - database value of False (default 0) bool(dbTrue) must be True and bool(dbFalse) must be False""" | def getIndexLabel(self, value): views = [FOREIGN_DROP.getLabel(self, i) for i in value] return ', '.join(views) |
from FieldTypes import IMAGE | from qFieldTypes import IMAGE | def do_delete(self, item): from FieldTypes import IMAGE from glob import glob for field_name, field_type in item.stream.itemExtFields.items(): if isinstance(field_type, IMAGE): image = getattr(item, field_name) for old_path in glob(image.pattern+'.*'): os.remove(old_path) |
from FieldTypes import IMAGE | from qFieldTypes import IMAGE | def do_make(self, item): from FieldTypes import IMAGE from glob import glob for field_name, field_type in item.stream.itemExtFields.items(): if isinstance(field_type, IMAGE): image = getattr(item, field_name) if image: fp = self.writer.getFP(image.path) fp.write(open(field_type.editRoot+image.path).read()) fp.close() e... |
stream = self._retrieve_stream(item) | stream = self.itemField._retrieve_stream(item) | def convertFromForm(self, form, name, item): value = form.getlist(name) stream = self._retrieve_stream(item) return self.convertFromCode( [stream.fields.id.convertFromString(id, item) \ for id in value], item) |
def parseaddr(addr): ''' decode header to unicode and aprse it ''' | def getaddr(addr): ''' extract address from encoded header ''' | def parseaddr(addr): ''' decode header to unicode and aprse it ''' uni_addr = [] for chunk, charset in email.Header.decode_header(addr): if charset: uni_addr += unicode(chunk, charset) else: uni_addr += chunk uni_addr = u''.join(uni_addr) return email.Utils.parseaddr(uni_addr) |
return email.Utils.parseaddr(uni_addr) | return email.Utils.parseaddr(uni_addr)[1].encode('us-ascii') | def parseaddr(addr): ''' decode header to unicode and aprse it ''' uni_addr = [] for chunk, charset in email.Header.decode_header(addr): if charset: uni_addr += unicode(chunk, charset) else: uni_addr += chunk uni_addr = u''.join(uni_addr) return email.Utils.parseaddr(uni_addr) |
addr = parseaddr(message['to'])[1] | addr = getaddr(message['to']) | def send(self, message): #addr = email.Utils.parseaddr(message['to'])[1] addr = parseaddr(message['to'])[1] logger.info('Sending mail to %s', addr) |
perms = self.user.getPermissions( self.isNew and field_type.createPermissions or field_type.permissions) | if self.isNew: permissions = field_type.createPermissions else: permissions = field_type.permissions perms = self.user.getPermissions(permissions) | def allowedFields(self, item): # assume item.type=='item' itemFieldsOrder = [] for field_name, field_type in item.fields.iteritems(): perms = self.user.getPermissions( self.isNew and field_type.createPermissions or field_type.permissions) if ('w' in perms or 'r' in perms) and \ not (self.isNew and field_type.omitForNew... |
perms = self.user.getPermissions(self.isNew and field_type.createPermissions or field_type.permissions) | if self.isNew: permissions = field_type.createPermissions else: permissions = field_type.permissions perms = self.user.getPermissions(permissions) | def showField(self, item, name): '''Return representation of field in editor interface''' field_type = item.fields[name] stream_perms = self.user.getPermissions(item.stream.permissions) perms = self.user.getPermissions(self.isNew and field_type.createPermissions or field_type.permissions) if 'w' in stream_perms and 'w'... |
user.checkPermission('w', isNew and field_type.createPermissions or field_type.permissions): | user.checkPermission('w', permissions): | def storableFields(self, item, user, isNew=0): itemFieldsOrder = [] id_field_name = item.fields.idFieldName for field_name, field_type in item.fields.iteritems(): if field_name!=id_field_name and \ user.checkPermission('w', isNew and field_type.createPermissions or field_type.permissions): itemFieldsOrder.append(field_... |
file_name = file_list[0] | file_name = '/'.join(os.path.split(file_list[0])) | def path(self): if self.body: return self.pattern+'.'+self._image.format.lower() else: from glob import glob file_list = glob(self.field_type.editRoot+self.pattern+'.*') if file_list: file_name = file_list[0] return file_name[len(self.field_type.editRoot):] |
allowedFields = qUtils.CachedAttribute(getAllowedFields) | allowedFields = qUtils.CachedAttribute(getAllowedFields, 'allowedFields') | def getAllowedFields(self, obj=None): if obj is None: obj = self.object # assume obj.type=='item' stream = obj.stream item_fields = stream.allItemFields itemFieldsOrder = [] for field_name in stream.itemFieldsOrder: field_type = item_fields[field_name] perms = self.edUser.getPermissions(field_type.permissions) if 'w' i... |
allowedIndexFields = qUtils.CachedAttribute(getAllowedIndexFields) | allowedIndexFields = qUtils.CachedAttribute(getAllowedIndexFields, 'allowedIndexFields') | def getAllowedIndexFields(self, obj=None): if obj is None: obj = self.object # assume obj.type=='stream': stream = obj item_fields = stream.allStreamFields itemFieldsOrder = [] if self.edUser.checkPermission('x', stream.permissions): for field_name in stream.itemFieldsOrder+\ getattr(stream, 'joinFields', {}).keys(): f... |
isStreamUpdatable = qUtils.CachedAttribute(checkIfStreamUpdatable) | isStreamUpdatable = qUtils.CachedAttribute(checkIfStreamUpdatable, 'isStreamUpdatable') def checkIfStreamUnbindable(self, obj=None): if obj is None: obj = self.object return hasattr(obj, 'joinField') and \ self.edUser.checkPermission('w', brick.allItemFields[brick.joinField].indexPermissions) isStreamUnbindable = qUti... | def checkIfStreamUpdatable(self, obj=None): if obj is None: obj = self.object allowedIndexFields = self.allowedIndexFields else: allowedIndexFields = self.getAllowedIndexFields(obj) # assume obj.type=='stream': stream = obj if self.edUser.checkPermission('w', stream.permissions): item_fields = stream.allStreamFields fo... |
class Authentication: | class Authentication(object): | def getUser(self, login=None): if login: table, fields, condition, group, order = self.constructQuery() condition = self.dbConn.join( [condition, Query('%s=' % self.loginField, Param(login))]) items = self.itemsByQuery(table, fields, condition, group=group) if items: return items[0] # return default "False" user return... |
return user | return user else: return stream.getUser(None) | def login(self, publisher, request, response, form): login, passwd, perm_login = [form.getfirst(name) for name in \ ('login', 'passwd', 'perm_login')] # crypt method used below only supports string types try: passwd = str(passwd) except UnicodeEncodeError: passwd = None |
def __init__(self, templateStream, paramStream, paramName, prefix=None, | def __init__(self, templateStream, paramStream, paramName, format=None, prefix=None, | def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix = prefix self.s... |
if prefix is None: self.prefix = paramStream | if format is None: self.prefix = (prefix or paramStream)+'/' self.suffix = '' | def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix = prefix self.s... |
self.prefix = prefix | self.prefix, self.suffix = format | def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix = prefix self.s... |
parts = stream_path.split('/') if len(parts)>=2 and '/'.join(parts[:-1])==self.prefix: | if stream_path.startswith(self.prefix) and \ stream_path.endswith(self.suffix): param_item_id_str = stream_path[len(self.prefix):] if self.suffix: param_item_id_str = param_item_id_str[:-len(self.suffix)] | def match(self, site, stream_path, tag=None): parts = stream_path.split('/') if len(parts)>=2 and '/'.join(parts[:-1])==self.prefix: param_stream = site.retrieveStream(self.paramStream, tag=site.transmitTag(tag)) try: param_item_id = \ param_stream.fields.id.convertFromString(parts[-1]) except ValueError: return param_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.