From 9db98d7cee93671c0fcc4bad1c6952a539e456a1 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Fri, 1 Apr 2011 01:00:46 +0100 Subject: [PATCH] Add __str__ methods to CModule, CUser, CChan, and CNick in modpython --- modules/modpython/modpython.i | 21 +++++++++++++++++++++ modules/modpython/znc.py | 2 ++ 2 files changed, 23 insertions(+) diff --git a/modules/modpython/modpython.i b/modules/modpython/modpython.i index abc9189c..67b110b4 100644 --- a/modules/modpython/modpython.i +++ b/modules/modpython/modpython.i @@ -119,6 +119,9 @@ public: }; %extend CModule { + CString __str__() { + return $self->GetModName(); + } MCString_iter BeginNV_() { return MCString_iter($self->BeginNV()); } @@ -142,6 +145,24 @@ public: } } +%extend CUser { + CString __str__() { + return $self->GetUserName(); + } +}; + +%extend CChan { + CString __str__() { + return $self->GetName(); + } +}; + +%extend CNick { + CString __str__() { + return $self->GetNick(); + } +}; + /* Web */ %template(StrPair) pair; diff --git a/modules/modpython/znc.py b/modules/modpython/znc.py index 0b60f063..6e80424f 100644 --- a/modules/modpython/znc.py +++ b/modules/modpython/znc.py @@ -113,6 +113,8 @@ class ModuleNV(collections.MutableMapping): raise NotImplemented class Module: + def __str__(self): + return self.GetModName() def OnLoad(self, sArgs, sMessage): return True def _GetSubPages(self):