Here's a patch implementing my try at this. I added a get_module_compile_path() to smerl to extract a given module's compile path from it's module_info(). I also added logic to erlydb to inspect this path and reject any classes which the string "/otp_src_R" in their path:
1> test_util:start_erlydb("foo", "foo", "foo", "localhost", [user]).
--- To skip foreign key checks, compile with the {skip_fk_checks,
true} option
** exception exit: {extending_system_module,{{module,user},
{compile_path,"/ldisk/
daily_build/otp_prebuild_r12b.2007-12-04_15/otp_src_R12B-0/lib/kernel/
src/user.erl"}}}
If there's a better way to do it, let me know and I'll take another
crack at it.
--Kevin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
no_system_modules.patch
Description: Binary data
On Dec 28, 2007, at 12:46 PM, Yariv Sadan wrote:
>
> Yes, definitely. I think ErlyDB should just crash when it tries to
> compile a module called 'user' because a few people have ran into
> this.
>
> On Dec 28, 2007 8:34 AM, Kevin A. Smith <[EMAIL PROTECTED]>
> wrote:
>>
>> Imagine my chagrin when I saw this line in the output of
>> user:module_info():
>>
>> {source,"/ldisk/daily_build/otp_prebuild_r12b.2007-12-04_15/
>> otp_src_R12B-0/lib/kernel/src/user.erl"}
>>
>> I'm guessing it would be helpful to _not_ use a module name which
>> clashes with the OTP provided modules. :-)
>>
>> I was thinking about cooking up a patch to emit a warning message
>> when
>> erlydb tries to process a builtin class like this one. Would this be
>> useful to anyone else?
>>
>> --Kevin
>>
>> On Dec 27, 2007, at 8:29 PM, Kevin A. Smith wrote:
>>
>>>
>>> Tried this with 0.7 and am still seeing the same problem.
>>>
>>> --Kevin
>>> On Dec 27, 2007, at 11:30 AM, Kevin A. Smith wrote:
>>>
>>>>
>>>> Do I need to do anything special in my module definition to get
>>>> ErlyDb
>>>> to use my custom before_save/1 implementation? I'm using erlyweb
>>>> 0.6.2
>>>> and the function doesn't get called when I save the record:
>>>>
>>>> 6> U = user:new_with([{first_name, "foo"}, {last_name, "bar"},
>>>> {password, "abcdef"}, {userid, "fbar"}]).
>>>> {user,true,undefined,"foo","bar","fbar","abcdef",undefined}
>>>> 7> U1 = user:save(U).
>>>> {user,false,24,"foo","bar","fbar","abcdef",undefined}
>>>> 8> U1.
>>>> {user,false,24,"foo","bar","fbar","abcdef",undefined}
>>>> 9> q().
>>>>
>>>> The user module looks like this:
>>>>
>>>> -module(user).
>>>>
>>>> -export([relations/0, before_save/1]).
>>>>
>>>> relations() ->
>>>> [{one_to_many, [email_address]}].
>>>>
>>>> before_save(Me) ->
>>>> io:format("before_save/1 called~n").
>>>>
>>>> Pointers? Ideas?
>>>>
>>>> Thanks,
>>>> Kevin
>>>>
>>>>>
>>>
>>>
>>>>
>>
>>
>>>
>>
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "erlyweb" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to [EMAIL PROTECTED]
> For more options, visit this group at
> http://groups.google.com/group/erlyweb?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
