Zotonic
Zotonic
zotonic@conference.zotonic.com
Friday, 6 January 2012< ^ >
arjan has set the subject to: Zotonic - the Erlang CMS
Room Configuration

GMT+1
[02:16:16] t is now known as trelane
[02:31:10] Rick Cogley leaves the room
[03:23:09] Rick Cogley joins the room
[03:25:03] trelane leaves the room
[03:43:55] Rick Cogley leaves the room
[03:49:54] Rick Cogley joins the room
[04:53:09] Rick Cogley leaves the room
[05:03:45] Rick Cogley joins the room
[05:04:36] Rick Cogley leaves the room
[05:54:20] Rick Cogley joins the room
[08:45:49] arjan joins the room
[09:04:57] <arjan> that is a typical error when beam.smp is already running.. are you sure of that?
[09:47:12] arjan leaves the room
[10:27:41] kaos joins the room
[11:13:06] Rick Cogley leaves the room
[11:33:47] arjan joins the room
[13:27:26] maas.maarten.zeeman joins the room
[13:58:16] <maas.maarten.zeeman> Hi Arjan, discovered a bug in the module indexer. It doesn't find services in modules with an underscore in it. :-/
[13:58:53] <arjan> oh?
[13:58:55] <arjan> darn
[13:59:59] <maas.maarten.zeeman> if the a module is named foo_bar the service is never found in the module indexer
[14:00:16] <maas.maarten.zeeman> will look into it and push a fix.
[14:01:16] <maas.maarten.zeeman> all other things (templates, and such) are found
[14:01:32] <arjan> yes I think it is in resource_api
[14:01:41] <arjan> the way the service is found is a bit strange
[14:02:35] <maas.maarten.zeeman> checked resource api, that is not it. The service is not listed in z_service:all
[14:03:05] <maas.maarten.zeeman> when i moved the same file to another module it worked (after a bit of renaming)
[14:04:29] <maas.maarten.zeeman> triple, what quadruple checked the directory name and such
[14:05:41] <arjan> bizarre
[14:06:29] <arjan> so it's not listed in z_module_indexer:find_all(service, true, Context)
[14:07:15] <maas.maarten.zeeman> yes
[14:07:36] <maas.maarten.zeeman> but not in z_service:all hmm, funny
[14:08:21] <maas.maarten.zeeman> so it's not the indexer... getting closer
[14:11:27] <maas.maarten.zeeman> It is z_module_manager:active :-)
[14:13:04] <maas.maarten.zeeman> ow, no, z_service:module :-)
[14:13:55] <maas.maarten.zeeman> It looks for the first underscore, and it uses that as the module name
[14:14:19] <maas.maarten.zeeman> so service_foo_bar_create will look for foo module
[14:14:29] <maas.maarten.zeeman> mod_foo
[14:15:36] <maas.maarten.zeeman> Now what is a good way fix that? You could have methods with underscores in it too.
[14:20:02] <maas.maarten.zeeman> Maybe add a -svc_module directive to the service code and check that (if available)
[14:21:12] <arjan> z_service:module/1 is a strange function indeed
[14:30:00] <maas.maarten.zeeman> It is also possible to lookup the module name via the source attribute in module info
[14:32:18] <maas.maarten.zeeman> Also messy
[14:44:42] <maas.maarten.zeeman> It is much easier. The indexer already knows the method name. So it is a matter of stripping off the service_ in front and the method name at the end. What remains should be the module name
[14:46:39] <arjan> true
[14:48:49] <maas.maarten.zeeman> It would be nice if that info could be attached to the attributes in module_info
[14:58:51] <maas.maarten.zeeman> Of course not possible to change that :-) Btw, there is a similar problem with the methods/1 call.
[15:23:39] kaos leaves the room
[15:31:12] <maas.maarten.zeeman> Arch, sometimes that dynamic loading is messy. Zotonic has dependencies between modules. I'm thinking about creating a macro which returns the atom of the zotonic module the current module belongs to. ?ZMODULE or something.
[15:34:58] <arjan> that would be nice
[15:35:02] <arjan> but how would you do that?
[15:35:26] <arjan> can't look at the name of the beam
[15:35:44] <maas.maarten.zeeman> With the predefined ?FILE macro I think
[15:36:05] <maas.maarten.zeeman> And a bit of messy code :-)
[15:36:51] <arjan> aaah, ?FILE
[15:36:56] <arjan> did not know that one
[15:36:59] <maas.maarten.zeeman> haha
[15:37:38] <maas.maarten.zeeman> The preprocessor snugs that one in. Probably for debug prints
[15:41:16] <maas.maarten.zeeman> Could also be nice to find out the name of the site ?ZSITE. Hmm, dunno...
[15:41:41] <arjan> a site is just a module, right?
[15:42:25] <maas.maarten.zeeman> Dumb idea I think.
[15:43:07] <maas.maarten.zeeman> Doesn't solve a thing.
[15:43:26] <maas.maarten.zeeman> It gets something you already know beforehand.
[15:44:00] <maas.maarten.zeeman> Except that you can type it once.
[15:46:33] <arjan> hehe
[15:47:06] <maas.maarten.zeeman> Maybe Marc has a bright idea. He usually does :-)
[15:47:38] <arjan> I dont mind using ?FILE
[15:47:43] <maas.maarten.zeeman> No?
[15:48:03] <arjan> well
[15:48:43] <arjan> actually, does not solve it indeed
[15:48:43] <arjan> hehe
[15:49:02] <arjan> you need to find the source path of the .erl given the erlang module
[15:49:14] <arjan> in usual erlang there is never a need for that
[15:49:37] <arjan> but zotonic is special regarding the organisation of files
[15:49:50] <arjan> if only all zotonic modules and sites were proper erlang apps... :)
[15:49:57] <arjan> you could use code:whereis/1 :)
[15:50:28] <maas.maarten.zeeman> Indeed, zotonic is a bit different in that respect.
[16:10:52] <maas.maarten.zeeman> Hang on, resource_api should use the module indexer to lookup the method. You will only get back methods from services from active modules.
[16:14:51] <arjan> ofcourse
[16:18:46] <maas.maarten.zeeman> Going to fix resource_api then. :-)
[16:21:11] <arjan> :D
[17:28:30] arjan leaves the room
[18:22:14] arjan joins the room
[18:38:28] arjan leaves the room
[19:27:50] arjan joins the room
[19:48:57] arjan leaves the room
[19:50:19] arjan joins the room
[20:43:59] arjan leaves the room
[22:16:17] arjan joins the room
[22:32:05] arjan leaves the room
[22:32:47] arjan joins the room
[23:12:04] arjan leaves the room
[23:43:10] arjan joins the room
[23:44:18] arjan leaves the room
Powered by ejabberd Powered by Erlang Valid XHTML 1.0 Transitional Valid CSS!